Hi,
I got this code from amibroker website and would like to include the buy/long condition is reverse to the short . Could someone please help me out ? Thanks
fCl = Ref(C,-1);
fHigh = Ref(H,-1);
fLow = Ref(L,-1);
fAdvDrop = fCl - Ref(C,-2);
fAtr = Ref(ATR(8),-1);
diffHl = fHigh-fLow;
fStoch = Ref(StochD(14),-1);
fBBandTop=Ref(BBandTop(C,20,2),-1);
fOpCond = fCl - 0.5 * fAtr;
fOp = Ref(O,0);
fStopLoss = fHigh + 0.5 * fAtr;
bbTopSell =
// The stock must first puncture and close outside (above) the upper Bollinger Band
IIf( fCl > fBBandTop AND
// The closer the closing price is to the high of the day, the better.
fCl > (fLow + 0.75 * diffHL ) AND
// And the bigger the day's advance, the better
fAdvDrop > (1.5 * fAtr) AND
// On the following day, the stock must 'gap' down below the prior day's close.
// This 'gap down' is crucial as it serves as the most important criteria of
// the entire strategy.
fOp < fOpCond AND
// Overbought condition added
fStoch > 80, 1, 0 );
/* Exploration Columns for Sorting */
NumColumns = 10;
Column0 = fOp;
Column1 = fOpCond;
Column2 = fStopLoss;
Column0Name = "Open";
Column1Name = "OpenCond";
Column2Name = "StopLoss";
Column0Format = 1.2;
Column1Format = 1.2;
Column2Format = 1.2;
Filter = bbTopSell == 1;
Buy = 0;
Sell = bbTopSell>0;
I got this code from amibroker website and would like to include the buy/long condition is reverse to the short . Could someone please help me out ? Thanks
fCl = Ref(C,-1);
fHigh = Ref(H,-1);
fLow = Ref(L,-1);
fAdvDrop = fCl - Ref(C,-2);
fAtr = Ref(ATR(8),-1);
diffHl = fHigh-fLow;
fStoch = Ref(StochD(14),-1);
fBBandTop=Ref(BBandTop(C,20,2),-1);
fOpCond = fCl - 0.5 * fAtr;
fOp = Ref(O,0);
fStopLoss = fHigh + 0.5 * fAtr;
bbTopSell =
// The stock must first puncture and close outside (above) the upper Bollinger Band
IIf( fCl > fBBandTop AND
// The closer the closing price is to the high of the day, the better.
fCl > (fLow + 0.75 * diffHL ) AND
// And the bigger the day's advance, the better
fAdvDrop > (1.5 * fAtr) AND
// On the following day, the stock must 'gap' down below the prior day's close.
// This 'gap down' is crucial as it serves as the most important criteria of
// the entire strategy.
fOp < fOpCond AND
// Overbought condition added
fStoch > 80, 1, 0 );
/* Exploration Columns for Sorting */
NumColumns = 10;
Column0 = fOp;
Column1 = fOpCond;
Column2 = fStopLoss;
Column0Name = "Open";
Column1Name = "OpenCond";
Column2Name = "StopLoss";
Column0Format = 1.2;
Column1Format = 1.2;
Column2Format = 1.2;
Filter = bbTopSell == 1;
Buy = 0;
Sell = bbTopSell>0;