Simple Coding Help - No Promise.

Hi nifty trade

You can try this AFL based on zigzag.

Horizontal line will be plotted when you move the cursor to any candle, wont change unless you move the cursor. changing pivots can be seen with arrow marks.

P.S. For New Bies, Its based on Repainting ZigZag. Handle with care:D
bro i was talking about pivot points named as pp, r1, r2 , r3 , s1, s2, s3 :)
 
Hi nifty trade

Post your PivotPoint AFL i will try to change as per your requirement.
hi

its not my AFL but taken from the forum only made by kelvinhand bro, thanks for helping me out bro

PHP:
_SECTION_BEGIN("pivots hourly 2");
_SECTION_BEGIN ("Chart Setup");
SetChartBkColor(ParamColor("Outer panel",colorSkyblue));
SetChartBkGradientFill(
ParamColor("Upper Inner panel",colorLightBlue),
ParamColor("Lower Inner panel",colorLightYellow)); 

SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);

//basic price plotting
_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", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END ();

_SECTION_BEGIN ("Pivot Levels");

//--- Created by : KelvinHand -------
T_F =ParamList("TF Multiplier","Hour|Min|Day|Week|Month");
iInterval = Param("Interval", 1, 1);

Note1=ParamStr("-- Colors --", "PP, S1..S3, R1..R3");
PP_Color=ParamColor("PP Color",colorViolet);
Rn_Color=ParamColor("Rn Color",colorDarkRed);
Sn_Color=ParamColor("Sn Color",colorDarkGreen);
 
Note1=ParamStr("-- Styles --", "PP, R1S1, R2S2, R3S3");
PP_Style=ParamStyle("PP", styleDots|styleThick, maskAll);
R1S1_Style=ParamStyle("R1S1 Style", styleThick, maskAll);
R2S2_Style=ParamStyle("R2S2 Style", styleLine,  maskAll);
R3S3_Style=ParamStyle("R3S3 Style", styleDashed,maskAll);



_SECTION_END ();


shift=-1;

switch (T_F)
{
    case "Day":     iPeriod  = inDaily;        break;
    case "Hour":    iPeriod  = inHourly;    break;
    case "Min":        iPeriod  = in1Minute;    break;
}
     
  
     xTF = iInterval*iPeriod;
        H1 = TimeFrameGetPrice( "H", xTF, shift );
        L1 = TimeFrameGetPrice( "L", xTF, shift );
        C1 = TimeFrameGetPrice( "C", xTF, shift );

// To calculate the Pivot Levels 
      PP = (H1 + L1 + C1) / 3;

    R1 = (2 * PP) - L1 ;
    S1 = (2 * PP) - H1 ;
    R2 = PP - s1 + r1;
    S2 = PP - (r1 - s1) ;
    R3 = 2 * (PP - L1) + H1 ;
    S3 = L1 - (2 * (H1 - PP));

//    Plot Pivot Levels in the charts

//Plot (PP,"",PP_Color,PP_Style);

//Plot (R1,"",Rn_Color,R1S1_Style);
//Plot (S1,"",Sn_Color,R1S1_Style);

//Plot (R2,"",Rn_Color,R2S2_Style);
//Plot (S2,"",Sn_Color,R2S2_Style);

//Plot (R3,"",Rn_Color,R3S3_Style);
//Plot (S3,"",Sn_Color,R3S3_Style);

/*
BC = (High + Low)/2
TC = (Pivot - BC) + Pivot
*/

BC = (H1 + L1)/2;
TC = (PP - BC) + PP;
PlotOHLC(TC,BC,TC,BC,"",colorGrey50,styleNoLabel|styleCloud);


//    Add Pivot levels on charts as text
Title = Title + EncodeColor(colorDarkTeal)+
"\nPivot T_F = "+NumToStr(iInterval,1.0)+" "+T_F + "\n" +
EncodeColor(Rn_Color)+"R3 = "+ r3 +"\n"+
EncodeColor(Rn_Color)+"R2 = "+ r2 + "\n"+
EncodeColor(Rn_Color)+"R1 = "+ r1 + "\n"+ "\n"+
EncodeColor(PP_Color)+"PP = "+ PP + "\n"+ "\n" +
EncodeColor(Sn_Color)+"S1 = "+ s1 + "\n"+
EncodeColor(Sn_Color)+"S2 = "+ s2 + "\n"+
EncodeColor(Sn_Color)+"S3 = "+ s3 + "\n";

_SECTION_END ();  

x=PP[BarCount-1];
for(i=BarCount-2; i>0; i--)
    if (PP[i]!=x) 
    {
      i++;
      break;
    }  


for(j=0; j<i; j++)
{
pp[j]=Null;
R1[j]=Null;
S1[j]=Null;
R2[j]=Null;
S2[j]=Null;
R3[j]=Null;
S2[j]=Null;
}

//    Plot Pivot Levels in the charts
Plot (PP,"",PP_Color,PP_Style|styleNoRescale);

Plot (R1,"",Rn_Color,R1S1_Style|styleNoRescale);
Plot (S1,"",Sn_Color,R1S1_Style|styleNoRescale);

Plot (R2,"",Rn_Color,R2S2_Style|styleNoRescale);
Plot (S2,"",Sn_Color,R2S2_Style|styleNoRescale);

Plot (R3,"",Rn_Color,R3S3_Style|styleNoRescale);
Plot (S3,"",Sn_Color,R3S3_Style|styleNoRescale);
_SECTION_END();
 

Nehal_s143

Well-Known Member
Data coming in live feed is getting changed after back fill is done, I want to check by comparing before back fill and after back fill data

I want to plot text Open, high, low & close below each candle for last 15 candles

I tried to do it but could not get the result also google but did not found similar afl

please help to write code
 
Data coming in live feed is getting changed after back fill is done, I want to check by comparing before back fill and after back fill data

I want to plot text Open, high, low & close below each candle for last 15 candles

I tried to do it but could not get the result also google but did not found similar afl

please help to write code
If you want to do it for one (or few) scrips, you can do it as follows

Example symbol is X
1) Rename the original symbol to X_ORIG
2) Create another symbol X and let the live feed go to that one
3) Before backfill, rename X to X_LIVE
4) Create another symbol X and backfill
5) Now, you can plot X_ORIG, X_LIVE and X (backfill) on same chart

Do take backups and do remember to delete the unwanted symbols when you are done
 
Hi
I need buy/sell arrows along with scanning requirement for following setup.
1)EMA : 5 &10.When 5 ema cross 10 ema from above/below then buy/sell .
2)MACD(9,12,26): crossover @ zero line from below/above then buy/sell.
3)stochastic(3-%D & 5-%k): cross above/below 50 line then buy/sell.
Will some experts help me in this regards? Once again i am requesting pl. help me.
Thanks.
 
Hi,
I am just a newbie to Amibroker. I have just bought the trial version and trying to write some afl.
I want a simple condition that if 6-ema crosses 18-ema then buy at next day's open price.
Sell on the open price on the day after buy was executed. for eg. if buy on 1st jan then sell on 2nd jan open price.
I only want to go long and not short.

I wrote the following AFL but it wasn't getting executed properly

fastma = MA(C,6);
slowma = MA(C,18);
SetTradeDelays(1,2,1,1);
BuyPrice=Open;
SellPrice=Open;
Buy=Cross(fastma,slowma);
Sell=Cross(fastma,slowma);
ExRem(Buy,Sell);


Could someone please explain me exrem function. I am not clear on how it works.

Thanks :)
 

Similar threads