Forum

MQL4 (in Strategy Tester) - double testing of entry conditions

Hi all, I would need to double-test the entry condition in my EA. The condition is the same but I want to test its validity with a time delay. for example: if (OPEN_CONDITION){ time_delay ( 2 s); if (OPEN_CONDITION){ OrderSend (); } } Sleep() function does not

custom indicator - return bar index for last bar with value greater than X

Hi all, I try to insert a variable into the custom indicator that returns to me the closest (lowest) BAR index (for example CCI) where value is greater than 100. example: For last 10 bars CCI have values [0, 50, 50, 20, 50, 99, 103, 102, 101, 0] extern int CCI_period = 14 ; extern int range= 10 ;

Find maximum range (iHigh-iLow) in last X bars

Hi all, I try write function in my EA which find maximum range (in points) for last (for example) 5 bars. But my code always return NULL. What I can: Get High and Low values for current bar (and bar[1],bar[2],bar[3],...), calculate range and convert to points. Create array of (last 5) ranges and

Custom indicator - compute average value

Hi all, I try to create my own indicator. Part of my indicator has to calculate the average value (example for last 5 bars) from CCI. int start() { int counted_bars = IndicatorCounted(); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; for(int i = limit - 1; i >= 0; i--)