OrderOpenPrice() returns value for the last selected order.
Function PREISLEVEL() calls OrderSelect() and is changing selected order.
You should call GRID_LOWER_1_HIGH() and GRID_LOWER_1_LOW() before loop in GRID_LOWER_1_BUYLIMIT().
Store results in local variable and compare variables. Something like this:
bool GRID_LOWER_1_BUYLIMIT() { bool Grid_Lower_1_Buylimit = false; double grid_lower_high = GRID_LOWER_1_HIGH(); double grid_lower_low = GRID_LOWER_1_LOW(); for(int i = OrdersTotal()-1; i >= 0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if(OrderType() == OP_BUYLIMIT) { if(OrderOpenPrice() < grid_lower_high && OrderOpenPrice() > grid_lower_low) ) { Grid_Lower_1_Buylimit = true; } } } } } return (Grid_Lower_1_Buylimit); };
Drazen Penic:
OrderOpenPrice() returns value for the last selected order.
Function PREISLEVEL() calls OrderSelect() and is changing selected order.
You should call GRID_LOWER_1_HIGH() and GRID_LOWER_1_LOW() before loop in GRID_LOWER_1_BUYLIMIT().
Store results in local variable and compare variables. Something like this:
Hi, THANKS for the answer.
Makes absolutely sense and now it works :-DDDDD
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi to all,
hope someone in the english section can help me.
I try to create a GRID-EA. For the following problem I will use the assumption just trading long.
1. Step: using an input variable to define the gridsize --> Grid_Abstand = e.g.: 200
2. Step : find out the current price-level on the chart --> PREISLEVEL() [it's the OrderOpenPrice() ofthe newest market-order]
3. Step : define the upper-level and the lower-level of the grid-area
unfortunately the check
if(OrderOpenPrice() < GRID_LOWER_1_HIGH() && OrderOpenPrice() > GRID_LOWER_1_LOW())
will not work and I have no idea why.
I tried several options, also by adding Print() after every single selection/task and I just could find out, that the a.m. "range-check" does not work out.
BUT the GRID_LOWER_1_HIGH() and GRID_LOWER_1_LOW() are defined and NOT unknown... so that is what confuses me.
Hope someone can help me and point out where my mystake is. Thx in advance :-)