Simple Coding Help - No Promise.

mastermind007

Well-Known Member
Joined
Dec 17, 2011
Messages
2,495
Likes
2,500
Two related but unrelated questions !!!

1) Does anyone know how to set the Auto repeat interval in AmiBroker Analysis window to be below 5 mins. The documentation does show interval in seconds but if I set it in seconds, Amibroker resets it back to 5mins. I have tried this in 6 different amibroker installations and I have no idea what is wrong. I am suspecting some default setting is wrong somewhere and I am without leads. Problem in itself is simple and requires no coding

Here is amibroker documentation that shows example setting in seconds
http://www.amibroker.com/kb/2014/10/03/how-to-setup-perodic-scans/


2) Data Window:
What is the best way to make use of the Data Window in Amibroker. You can look up in ami help window to find out what a data window is.

These are naturally basic questions and therefore seem simple
 

trash

Well-Known Member
Joined
Mar 22, 2012
Messages
684
Likes
981
Two related but unrelated questions !!!

1) Does anyone know how to set the Auto repeat interval in AmiBroker Analysis window to be below 5 mins. The documentation does show interval in seconds but if I set it in seconds, Amibroker resets it back to 5mins. I have tried this in 6 different amibroker installations and I have no idea what is wrong. I am suspecting some default setting is wrong somewhere and I am without leads. Problem in itself is simple and requires no coding

Here is amibroker documentation that shows example setting in seconds
http://www.amibroker.com/kb/2014/10/03/how-to-setup-perodic-scans/


2) Data Window:
What is the best way to make use of the Data Window in Amibroker. You can look up in ami help window to find out what a data window is.

These are naturally basic questions and therefore seem simple

1) You insert a custom interval like 1s and then you hit enter.

2) Data window shows some chart pane data when hovering over a bar with your mouse.

 
Last edited:

Tarang58

New Member
Joined
Jun 29, 2015
Messages
22
Likes
4
Hi
I need afl with buy/sell arrows along with scanning requirement for following setup.
1)Moving Average :5 EMA,10 EMA, crossover from below or above.
2)MACD(9,12,26): crossover above or below zero line.
3)Stochastic:(3-%D &5-%K):Crossover above/below 50.
Will some experts help me in this regard?
Thanks.
 

Tarang58

New Member
Joined
Jun 29, 2015
Messages
22
Likes
4
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?
Thanks.
 

nifty trade

Well-Known Member
Joined
Aug 26, 2014
Messages
1,135
Likes
1,213
hi

is there any AFL which could plot pivots points based on a certain candle selected , or certain period selected throughout the day, for example 1st 15 minute selected and based on it pp, r1,r2, s1 s2 ?......? would be better if could select the period for which the pivots , pp, r1,r2,r3 and s1 s2 s3 could be plotted .

thanks
 

amitrandive

Well-Known Member
Joined
Jul 26, 2010
Messages
8,717
Likes
23,669
hi

is there any AFL which could plot pivots points based on a certain candle selected , or certain period selected throughout the day, for example 1st 15 minute selected and based on it pp, r1,r2, s1 s2 ?......? would be better if could select the period for which the pivots , pp, r1,r2,r3 and s1 s2 s3 could be plotted .

thanks
Courtesy KelvinHand

Code:
_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);

//    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 ();
 

nifty trade

Well-Known Member
Joined
Aug 26, 2014
Messages
1,135
Likes
1,213
Courtesy KelvinHand

Code:
_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);

//    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 ();
Amit Bro

its not the one i was talking about , i am talking about non changing still pivots just like daily pivot points but based on 1 single candle , for example 1st 5 minutes or 1st 15 minutes , which will be plotted on intra chart without any change , so if i want to keep 15 minute 1st bar pivot points on chart through out the day , i could do it ............also it will be better if any hi and lo (custom)could be selected to draw the static pivots which will remain on the chart unless the selected point of hi lo are changed manually:)
 

amitrandive

Well-Known Member
Joined
Jul 26, 2010
Messages
8,717
Likes
23,669
Amit Bro

its not the one i was talking about , i am talking about non changing still pivots just like daily pivot points but based on 1 single candle , for example 1st 5 minutes or 1st 15 minutes , which will be plotted on intra chart without any change , so if i want to keep 15 minute 1st bar pivot points on chart through out the day , i could do it ............also it will be better if any hi and lo (custom)could be selected to draw the static pivots which will remain on the chart unless the selected point of hi lo are changed manually:)
Only had this,need expert opinion :D
 

KelvinHand

Well-Known Member
Joined
Jun 4, 2008
Messages
895
Likes
1,160
Location
Banned Forever
Only had this,need expert opinion :D
All these people always treat you as cheap labour.
Sometime i do thing a bit flexible n extension.
In the given code, before the plot, do some modification to extend the 1st 5, 15min pivot and extend to the end of the day and see. Default timeframe to 5min & try out the M15 pivot

you do, i not involve
 
Last edited:

vijayanscbe

Well-Known Member
Joined
Apr 10, 2008
Messages
322
Likes
528
Location
coimbatore
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

///////////////////////////////////////////////////////////////////////////////////////////
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} ,{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C, "", IIf(O>=C, colorOrange, colorGreen),styleCandle);

SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} Open:%g, Close:%g ,{{VALUES}}",O,C ));

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


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

per1=Param ("per1", 0.325,0.01,50,0.01);

per=per1;
x = Cum(1);
pS = TroughBars( L, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, L, 1 ) );
startS = SelectedValue( ValueWhen( pS, L, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDashed);

pR = PeakBars( H, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, H, 1 ) );
startR = SelectedValue( ValueWhen( pR, H, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDashed);

//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();
t1=(ValueWhen(PeakBars(H,perc)==0,x)) ;
t11=(ValueWhen(TroughBars(L,perc)==0, x));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);

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

Similar threads

Broker Special Offers