getting an EA to only open an order at the point where a new candle opens and other questions...

 

New at this EA programing and I'm having some issues...


I'm trying to get my EA to only open an order at the point where a new candle starts, so far with out luck. Can anyone suggest some code that will work or point me to a thread with this info?


I'm running diffrent EA's I have on the same pair on multiple time frames at the same time. So far, it will not open more than one order at at time, even if more than one chart give a signal to open an order...do different EA's on different charts read from the same pool of open orders when using the OrdersTotal() command?


I'm getting a large amount of 'error 130''s. I assume this is connected to my code that tries to adjust the stop lose and take profit. or when it is trying to open an order say at the end of a candle (which it is not suppost to). From what I have read, the 130 error is made when and new or modified order's stop lose or take profit is too close to either the ask or bid. can someone clearify this for me?



tia for any and all help on this, this stuff can be rather fustrating...


EM

 

EM


See this link for answers to two questions

'Need help for simple script using parabolic SAR'

Shows use of Volume[0]>1 to control execution

Also shows how to use Magic number to control orders

If you want to be able to reset MagicNumber, use them as externs so you would start the EA like

#property copyright "admin@selectfx.net"
#property link "http://www.selectfx.net"



extern int iMagicBuy=2233;
extern int iMagicSell=5566;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
 {

 }

// etc


IIRC, Error 130 is <invalid stops>?

Been a while since I've seen an error message ;)

> Frustrating?

You know nothing yet grasshopper - welcome to the jungle :)

Good Luck

-BB-