I am trying to do a strategy when you enter the position when the price is at certain % level of the price range of given previous period. - Near highs and lows of the period.
I thought the function MAX() would do that, but the script doesnt work and opens random trades on every bar
the code is as follows:
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 12)
return;
// Set 1
double value = MAX(High, 10)[0];
if (Close[0] >=( value *0.9))
{
EnterShort(Convert.ToInt32(DefaultQuantity), "");
}
.
.
The variable value is defined like this:
private double value;
It should open the trade when the price is in the range of 10% near the high of previous 10 bars.
Thanks for any advice
Comment