Please help with utility ea

Post Reply
jcs
Posts: 7
Joined: Fri May 18, 2012 1:25 pm

Please help with utility ea

Post by jcs »

Hi all

I am a total coding virgin

I have a very useful utility ea ( for me anyway ) that simply places an order in the selected diretion at the open of the next candle ( every candle )
I have looked everywhere on the web for a revised version that meets my requirements, with no luck
I have also tried my hamfisted cut and paste coding from other ea's but can not get the darn thing to work as I need

I would like the ea to place orders as follows :-

If OpenShort is selected - only place order if the previous candle was a BULL candle
If OpenLong is selected - only place order if the previous candle was a BEAR candle

Can some kind soul help me please
Thank you

Code: Select all

extern double LotSize    = 0.5;
extern bool   OpenShort  = true;
extern bool   OpenLong   = true;
extern int    Slippage   = 3;
extern double StopLoss   = 100;
extern double TakeProfit = 100;

int init()   { return(0); }
int deinit() { return(0); }
int start()
{
   static datetime prevTime = 0;
      if (prevTime==Time[0] || prevTime==0) 
      {
         prevTime=Time[0]; 
         return(0); 
      }
   double point = Point*MathPow(10,MathMod(Digits,2));
      if (OpenLong)  OrderSend(Symbol(),OP_BUY ,LotSize,Ask,Slippage,Ask-StopLoss*point,Ask+TakeProfit*point,"",0,0,CLR_NONE);
      if (OpenShort) OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*point,Bid-TakeProfit*point,"",0,0,CLR_NONE);
   prevTime=Time[0]; 
   return(0);
}
AnotherBrian

Please help with utility ea

Post by AnotherBrian »

If your broker is ECN then you need to place the order in 2 steps. First place the order without stops or targets. The use ordermodify to modify the order with target and stop (at same time)

Look in Steve's code where he uses IsECNorGlobalPrime and you will see the code for that. Cheers for trying!!
Keep it up.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Please help with utility ea

Post by SteveHopwood »

Here you are - took a couple of minutes using one of my shells so most of the usual stuff is there.

MaxTradesAllowed allows you to limit the number of trades the ea sends, so set it ridiculously high to disable the feature.

TradeLong/Short tells the bot which way to trade.

I haven't bothered to test this, so sing out if it doesn't work as expected.

:xm:
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
jcs
Posts: 7
Joined: Fri May 18, 2012 1:25 pm

Please help with utility ea

Post by jcs »

SteveHopwood » Wed Jul 01, 2015 4:31 pm wrote:Here you are - took a couple of minutes using one of my shells so most of the usual stuff is there.

MaxTradesAllowed allows you to limit the number of trades the ea sends, so set it ridiculously high to disable the feature.

TradeLong/Short tells the bot which way to trade.

I haven't bothered to test this, so sing out if it doesn't work as expected.

:xm:
Steve
Thanks for looking at this for me
The ea is not placing any trades
It loads ok and there are no error messages or any other messages in tabs other than confirmation the ea has initialized ... just no trades
Looks like it is not attempting to place trades ?
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Please help with utility ea

Post by SteveHopwood »

Oops.

Thee is a line of code in my shell that stops the trade sending function whilst I am developing my code. It's comment is "REMEMBER TO DELETE THIS".

I forgot to delete it. :arrrg:

This one should send trades.

:xm:
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
jcs
Posts: 7
Joined: Fri May 18, 2012 1:25 pm

Please help with utility ea

Post by jcs »

SteveHopwood » Wed Jul 01, 2015 9:24 pm wrote:Oops.

Thee is a line of code in my shell that stops the trade sending function whilst I am developing my code. It's comment is "REMEMBER TO DELETE THIS".

I forgot to delete it. :arrrg:

This one should send trades.

:xm:

Thankyou Steve

For the purposes of testing I have upped slippage to 10 to take this out of the equation
I have max trades at 100
All filters set to false

On 15 min timeframe the logic and trade entry seem to be perfect, so presumably this will be the same on higher timeframes
On the 5 minute timeframe trades are placed erratically, with many bars not having any trade as per the logic

As for me I will be unlikely to use this below 15 minutes, so all ok as is
Others are downloading the ea, so maybe you would want to try and resolve this for all ?

There is one issue I do need to resolve
As part of my standard set up I have an indicator called " ConPro "
If you are not familiar with it, what it does is show with a dynamic horizontal line the Buy average and Sell average positions seperately ( not summed as per Bob's 10.7 Line Of Zero ), together with a text display of profit and loss for buy and sell trades
This is very important to me

When I use the original ea with this indicator all works fine
But when I use the jcs utilty ea the Con Pro indicator does not function at all
I asume there must be something in the extensive ea code conflicting with the indicator code

Any Ideas what this could be ?
I am attaching the Con Pro indicator so you can have a look at the code, if you would be so kind

Really appreciate your help Steve
You do not have the required permissions to view the files attached to this post.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Please help with utility ea

Post by SteveHopwood »

You will need to go into the ea's DisplayUserFeedback() function and turn off the chart feedback with return; right at the start of the function.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
jcs
Posts: 7
Joined: Fri May 18, 2012 1:25 pm

Please help with utility ea

Post by jcs »

SteveHopwood » Thu Jul 02, 2015 6:14 pm wrote:You will need to go into the ea's DisplayUserFeedback() function and turn off the chart feedback with return; right at the start of the function.

:xm:
OK, many thanks
Post Reply

Return to “Coders Hangout”