An new indicator to see the range bound period and an EA similar need help

 

hi, everyone,

For searching the good time to place order, i'd like to find the range bound period. in my opinion, it should be a good market after the range bound. then i wrote the indicator named RangeBoundMA. it based on the different prices among the 3 SMA lines that the periods are 38,140,210. you can attach it to your chart with a horizontal line as 25. then you'll see once the indicator under the 25 line in some period, the prices are in the range bound. when the price break the highest or lowest price during the range bound, it is the just time to place order.

however, when i worte the code into an EA, it is always false that i can't get the reason because i am still new to EA mql4 code. would someone please help me to check the EA code? what wrong is it? will greatly appreciated if reply.

Files:
 
 
this is the indicator
Files:
 
The 2 files you posted are the same . . . can you show your iCustom calls . .
 
sorry, it is my mistake. attached, it is the EA code.
 

You can't use buffers in EAs . . . you use arrays instead . . . and when you define an array you have to say how big it is . . . or use array resize . . .

When looping through Orders and closing or deleting them your loop MUST count down not up

 
OK, i got it. thanks.
 
Reason: