Three bar strategy

Vertigo_1985

Well-Known Member
#57
Hi Vikas,
Amibroker AFL is as follows :-

// Inside bar
Buysignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));


// 1st and third candles Bull candle
Buysignal2 = (Ref(O,-2) < Ref(C,-2)) AND ( Open < Close);

//2nd Candle bear candle
Buysignal3 = (Ref(O,-1) > Ref(C,-1));

// Buy when inside bar, 1st and 3rd bar green

Buy = Buysignal1 AND Buysignal2 AND Buysignal3 ;

//Condition for plotting Buy if its true
PlotShapes( IIf( Buy,shapeUpArrow + shapePositionAbove , shapeNone ), colorGreen);

// SHORT TRADE

ShortSignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));

// 1st and third candles Bear candle
Shortsignal2 = (Ref(O,-2) > Ref(C,-2)) AND ( Open > Close);

//2nd Candle bull candle
Shortsignal3 = (Ref(O,-1) < Ref(C,-1));

Short = Shortsignal1 AND Shortsignal2 AND Shortsignal3 ;
PlotShapes( IIf( Short,shapeDownArrow , shapeNone ), colorRed );

/////////////////////

Entry trigger is on formation of third candle according to our condition, we can change it to inside candle and 2nd candle of opposite colour of 1st by deleting 3rd condition code.

I am getting overlapping arrows(with candles), tried to use offset in plotshapes but not working, if someone can look into it then it would be of great help.

Regards
 

Vertigo_1985

Well-Known Member
#58
Hi Vikas,
As you have been following this for quite some time can you share your results so far ?..

In most trades the target comes out to be small compared to the big move that actually happens sometime.
As using current system size of loses is approximately same as winners and win/loss ratio also not so great i think we would benefit if we use either trailing or multiple positions approach. Whats your view on that ?
 

johnnypareek

Well-Known Member
#59
Hi Vikas,
Amibroker AFL is as follows :-

// Inside bar
Buysignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));


// 1st and third candles Bull candle
Buysignal2 = (Ref(O,-2) < Ref(C,-2)) AND ( Open < Close);

//2nd Candle bear candle
Buysignal3 = (Ref(O,-1) > Ref(C,-1));

// Buy when inside bar, 1st and 3rd bar green

Buy = Buysignal1 AND Buysignal2 AND Buysignal3 ;

//Condition for plotting Buy if its true
PlotShapes( IIf( Buy,shapeUpArrow + shapePositionAbove , shapeNone ), colorGreen);

// SHORT TRADE

ShortSignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));

// 1st and third candles Bear candle
Shortsignal2 = (Ref(O,-2) > Ref(C,-2)) AND ( Open > Close);

//2nd Candle bull candle
Shortsignal3 = (Ref(O,-1) < Ref(C,-1));

Short = Shortsignal1 AND Shortsignal2 AND Shortsignal3 ;
PlotShapes( IIf( Short,shapeDownArrow , shapeNone ), colorRed );

/////////////////////

Entry trigger is on formation of third candle according to our condition, we can change it to inside candle and 2nd candle of opposite colour of 1st by deleting 3rd condition code.

I am getting overlapping arrows(with candles), tried to use offset in plotshapes but not working, if someone can look into it then it would be of great help.

Regards
Hope this is plotted arrow like u wanted

HTML:
_SECTION_BEGIN("Price");

GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
up=4969;
dn=4952;
//Plot(up,"UP Break",5,8);
//Plot(dn,"DN Break",4,8);


_SECTION_END();






// Inside bar
Buysignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));


// 1st and third candles Bull candle
Buysignal2 = (Ref(O,-2) < Ref(C,-2)) AND ( Open < Close);

//2nd Candle bear candle
Buysignal3 = (Ref(O,-1) > Ref(C,-1));

// Buy when inside bar, 1st and 3rd bar green

Buy = Buysignal1 AND Buysignal2 AND Buysignal3 ;

//Condition for plotting Buy if its true
//PlotShapes( IIf( Buy,shapeUpArrow + shapePositionAbove , shapeNone ), colorGreen);

// SHORT TRADE

ShortSignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));

// 1st and third candles Bear candle
Shortsignal2 = (Ref(O,-2) > Ref(C,-2)) AND ( Open > Close);

//2nd Candle bull candle
Shortsignal3 = (Ref(O,-1) < Ref(C,-1));

Short = Shortsignal1 AND Shortsignal2 AND Shortsignal3 ;
//PlotShapes( IIf( Short,shapeDownArrow , shapeNone ), colorRed );
PlotShapes(Buy * shapeUpArrow,colorGreen, 0,L, Offset=-10); 
PlotShapes(Short * shapeDownArrow,colorRed, 0,H, Offset=-10);

/////////////////////
 

VIKAS 21

Well-Known Member
#60
Dear vertigo

Can u post charts of ur trades/paper trades, so that i can understand & can give a solution to ur problem??
 

Similar threads