Three Bar Inside Bar Strategy
How To Trade Using The Three Bar Inside Bar Strategy
Calculation
price = getDouble(index, key, 0);
price1 = getDouble(index-1, key, 0);
high = getHigh(index);
high1 = getHigh(index-1);
low = getLow(index);
low1 = getLow(index-1);
askPrice = (price + (price * pt / 100));
bidPrice = (price - (price * pt / 100));
stopLongPrice = 0;
if (enterLongPrice != 0)
stopLongPrice = (enterLongPrice - (enterLongPrice * sl / 100));
endIf
stopShortPrice = MAX_VALUE;
if (enterShortPrice != 0)
stopShortPrice = (enterShortPrice + (enterShortPrice * sl / 100));
endIf
//Signals
cond1 = price moreThan price1;
cond2 = high lessThan high1 AND low moreThan low1;
cond3 = price lassThan price1;
cond12 = cond1[index-2];
cond21 = cond2[index-1];
cond32 = cond3[index-2];
enterLong = cond1 AND cond21 AND cond12;
enterShort = cond3 AND cond21 AND cond32;
exitLong = price lessThan stopLongPrice;
exitShort = price moreThan stopShortPrice;
if (enterLong) onSignal(enterLong);
if (enterShort) onSignal(enterShort);
if (exitLong) onSignal(exitLong);
if (exitShort) onSignal(exitShort);Last updated