Learn How To Fish

Status
Not open for further replies.

MSN1979

Well-Known Member
Not very easy. Especially when there are inside candles (and there are many). I tried to make one but I am not able to pin point pivots.
I mean its easier when condition are clearly defined, specially as in Vijay method break of 3 candles is a clear defenation of a pivot.
 

josh1

Well-Known Member
I mean its easier when condition are clearly defined, specially as in Vijay method break of 3 candles is a clear defenation of a pivot.
Yes.. However, taking care of this in code is giving me nightmares. See that three inside candles are breaking but there is only one mpl in below case.
1542791071363.png
 

josh1

Well-Known Member
This AFL marks Pivots in Amibroker. It is not 100% accurate but gives lot of assistance. Anybody who can modify it for inside candles is welcome to contribute.
Code:
/**********************************************************************************
**************************Start of  Vijay Pivot Breakout System***************************
                                   First Version.
**********************************************************************************/

_SECTION_BEGIN("Trading System - Parameters");


pivotoff = ParamToggle("Pivot Off","No|Yes",0);


if (pivotoff == 0) {


SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( C, "Close", colorWhite, styleNoTitle | styleCandle);

SV_LP=Param("Lookback Period for pivot?",4,2,50,1);

PH = H > Ref(HHV(H,SV_LP),-1) AND Ref(HHV(H,SV_LP),SV_LP)<=H;
PHP = ValueWhen(PH,H);
PL = L < Ref(LLV(L,SV_LP),-1) AND Ref(LLV(L,SV_LP),SV_LP)>=L;
    if(ParamToggle("Suppress Successive Same Pivots?","No,Yes")){  
        PH = ExRem(PH,PL);
        PL = ExRem(PL,PH);
    }

    if(ParamToggle("Plot Pivots?","No,Yes",1)){
        PlotShapes(IIf(PH,shapeSmallCircle,shapeNone),colorGreen,0,H,12);
        PlotShapes(IIf(PL,shapeSmallCircle,shapeNone),colorRed,0,L,-12);
    }
}

_SECTION_END();


/*************************End of Pivot Breakout System***************************/

_N(Title = StrFormat(EncodeColor( colorPaleGreen ) + "{{NAME}} - {{INTERVAL}} {{DATE}} " + " Open %g,"  + " Hi %g, "
+ " Lo %g, "  + " C %g  {{VALUES}}", O, H, L, C )
+EncodeColor( colorRed ) + "\n"+",  LH = " + NumToStr(Ref(H,-1), 1.4)  + ",    LL = "
+ NumToStr(Ref(L,-1), 1.4) + ",    LH2 = " + NumToStr(Ref(H,-2), 1.4) + ", LL2 = " + NumToStr(Ref(L,-2), 1.4));
 

travi

Well-Known Member
This AFL marks Pivots in Amibroker. It is not 100% accurate but gives lot of assistance. Anybody who can modify it for inside candles is welcome to contribute.
Have you checked the Zig fn and AFLs based on the ZigZag indicator?

One very good advantage is that you can set it percentage, say 0.5 for intra, so its able to filter all the noise out.

Code:
_SECTION_BEGIN("Zig");

SetChartOptions(2,chartShowArrows | chartShowDates | chartWrapTitle );
ZigPC = 0.5;

ZZ = Zig(C,LastValue(ZigPC));
PivotLow = Ref(IIf(Ref(ROC(ZZ,1),-1) < 0 AND ROC(ZZ,1) > 0, 1, Null),1);
PivotHigh = Ref(IIf(Ref(ROC(ZZ,1),-1) > 0 AND ROC(ZZ,1) < 0, 1, Null),1);
PlotShapes( IIf(PivotLow,shapeHollowSmallCircle,Null), colorGreen,0, L, -15);
PlotShapes( IIf(PivotHigh,shapeHollowSmallCircle,Null),colorRed,0,   H,  15);

BarColors = colorDefault;
Plot(C, " ", BarColors,  styleCandle ) ;
Plot(ZZ," ", colorLightGrey,styleLine);
Plot(ZZ," ", BarColors,styleDots|styleNoLine);


_SECTION_END();
 
Last edited:

VJAY

Well-Known Member
its not mph, exit usually left at ones discretion, commonly used are HVB, 2 candles etc.
No MSN no discretion in this method....for scratch trades......Yes its derived upon ones understanding of PA and risk in trades ...but make rules for scratch by some logic and follow it rigidly...thing is always ready for scratch when our trade not working as per our method/view.....restrict small loss in loosers and ride with winners......I have shared some like you said 2 bars/HVB,visual close etc.....
 
Status
Not open for further replies.

Similar threads