Simple Coding Help - No Promise.

chintan786

Well-Known Member
OI is a data field (similar to open,close or volume)

Amibroker will plot whatever you are getting from you data provider



:) Happy
If u can able to plot it in Ami then plz let me know. I trying this from some time but no respite.

chintan
 

Nehal_s143

Well-Known Member
Pratab Sir,

max(max(a,b), max(c,d))

works perfectly, getting correct values, Solution was perfect, I made silly mistake while writing max condition, hence was getting wrong value.

Thank you very much once again

Sir I used above max in afl, but I am getting wrong values


For testing I have used 3 day pivot range in old afl which can be used for max 4 days (bottom section in chart) & new max 8 days limit afl (top section) but the values are coming different

Bottom chart values are correct, I have checked manually.

Please suggest the solution
 
hi
happy sir

pl write an afl for

1. SMA of 5 weeks. 10weeks, and 40weeks in daily charts. I require an line displayed on the daily chart.
2. in exploration I should get the values as current value, 5 weeks sma, 10weeks sma, and 40 weeks sma. pl help

regards
explorer
 

ethan hunt

Well-Known Member
Hi Happy Singh,
Kindly help me to make an AFL as per following details:
Thanks,

AFL required for following Strategy:

Trades are executed as soon as the price touches the fixed price level & not at close, open, hi, lo.

Eg:

BUY:
Price is at the moment below 5800
Price starts to move up & touches 5800
Buy as soon as price touches the fixed price level of 5800
Target exit as soon as price touches fixed price level of 5900
Stop Loss exit as soon as price touches fixed price level of 5750
Trailing stop loss exit as soon as price touches fixed price level of 5850 on it's way down


SHORT:
Price is at the moment above 5900
Price starts to fall down & touches 5900
Short as soon as price touches the fixed price level of 5900
Target exit as soon as price touches fixed price level of 5800
Stop Loss exit as soon as price touches fixed price level of 5950
Trailing stop loss exit as soon as price touches fixed price level of 5850 on it's way up


AFL requirement:
Back testing
Scanning
Plots lines of fixed price levels with labels
Flexibility to change the fixed levels from parameters options.
Flexibility to add more fixed price levels
Can be used in any time frame
Buy / Short arrows etc

Basic AFL:

_SECTION_BEGIN("Price");
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", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
PlotGrid( 5950, colorGreen );
PlotGrid( 5900, colorGreen );
PlotGrid( 5850, colorGreen );
PlotGrid( 5800, colorGreen );
PlotGrid( 5750, colorGreen );
_SECTION_END();
 

XRAY27

Well-Known Member
Dear happy singh ji,
i want the close line in this afl to be blue when it is above heiken ashi and red when it is below heiken ashi price

_SECTION_BEGIN("Heiken Ashi");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorLightGrey ));
SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",6,2,40,1);
Om=MA(O,p);
hm=MA(H,p);
lm=MA(L,p);
Cm=MA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
Plot(C,"Close",colorBlue,styleThick);
_SECTION_END();
 

pratapvb

Well-Known Member
Dear happy singh ji,
i want the close line in this afl to be blue when it is above heiken ashi and red when it is below heiken ashi price

_SECTION_BEGIN("Heiken Ashi");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorLightGrey ));
SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",6,2,40,1);
Om=MA(O,p);
hm=MA(H,p);
lm=MA(L,p);
Cm=MA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
Plot(C,"Close",colorBlue,styleThick);
_SECTION_END();
replace the last line Plot(C,"Close",colorBlue,styleThick); with

Plot(C,"Close",iif(C>HaHigh, colorBlue, iif(C < HaLow, colorred, colorblack)),styleThick);
 

Similar threads