double previous = current[1] --> previous is a double, current is an array of some type
if (current>previous[1]) && (Order_Limit < 3 ) --> now, previous is an array ? how did that happen ?
double previous = current[1] --> previous is a double, current is an array of some type
if (current>previous[1]) && (Order_Limit < 3 ) --> now, previous is an array ? how did that happen ?
how about this one:
previous = high[1];
if (ask> previous)
Ordersend(...);
previous = high[1]; --> have you already declared the array high[] and stored some values in it ? or did you mean: https://docs.mql4.com/predefined/variables/high
yes I mean https://docs.mql4.com/predefined/variables/high, below image explains my buy condition:
1. new bar present
2. current price higher or lower than the previous bar's high or low
3. does not exceed order limit // in this case limit = 3.
how do i program this?
I do have a trailing stop as well, if 3 orders are opened, they will move their stoploss accordingly when each new bar reach higher or lower price levels.
Its kinda complex when put it in a program...m newbie and m stuck, need help veterans...many many thanks in advance!
Its kinda complex when put it in a program...m newbie and m stuck, need help veterans...many many thanks in advance!
It will always be complex until you learn . . unless the EA you have now is going to work for you and make you all the money you want . . .
Some pointers . . .
static datetime LastOrderTime=10; if ( OrdersTotal() < 3 && Bid > High[1] && LastOrderTime < Time[1]) { // place new Order LastOrderTime = Time[1]; // <--- prevents placing more than 1 order per bar }
It will always be complex until you learn . . unless the EA you have now is going to work for you and make you all the money you want . . .
Some pointers . . .
Thanks, Raptor, I added your code and it worked, really appreciated!
But the test result were worse than placing only one order at a time, i guess there's still long way to go...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I would like to make an program that can open orders when every new bar presents
conditions are
1. new bar present
2. current price higher or lower than the previous bar's high or low
3. does not exceed order limit // how many times it can open order in one direction.
e.x. for uptrend,
int Order_Limit = 3
double current=ask;
double previous = current[1]
if (current>previous[1]) && (Order_Limit < 3 )
Ordersend(....);
Of course above code does not work, hope someone could help me answer this, many many thanks!