+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

LTS Stay Long

The AFL ‘LTS Stay Long’ in Amibroker leverages the platform’s AFL capabilities and the integral Amibroker data feed. This indicator likely assists traders in identifying favorable conditions for prolonged positions. By analyzing market trends and criteria through the Amibroker data feed, ‘LTS Stay Long’ aids in strategic decision-making, enabling traders to stay in positions aligned with sustained market movements.

/
_SECTION_BEGIN("Simple Pivot based Trading System");


PMA = Param("ma OF",25,1,100,1);
Color_buy = IIf(Close > EMA(Close,89) AND Close > MA(High,pma),colorBlue,IIf(Close < EMA(Close,89) AND Close < MA(Low,pma),colorRed,colorYellow));

// User defined parameters.

GraphXSpace = 10; //defines how much extra space should be added above and below graph line (in percent).

dist = 0.25*ATR(10); 
Capital=Param("Total capital",100000,10000,1000000,1000);
drawdown=Param("Max. loss per trade as % of Capital", 1.0,0.5,25.0,0.1);
room=Param("Room for S/L as % of Pivot value",0.001,0.0,0.02,0.001);

// Now calculate pivots. Method courtesy : Kenneth (www.traderji.com)

PH= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));

PL= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));

// filter lines

phfilter=PH+(room*PH);
plfilter=PL-(room*PL);

//Uncomment following code if you wish to see the pivot lines.
Plot(Ref(PH,2), "UpPivot", ParamColor("UpPivot Color",colorRed), styleDashed);
Plot(Ref(PL,2), "DownPivot",ParamColor("DownPivot Color",colorGreen), styleDashed);

Plot(Ref(Phfilter,2), "Upfilter", ParamColor("upfilter Color",colorRed), styleLine);
Plot(Ref(Plfilter,2), "Downfilter",ParamColor("dnfilter Color",colorGreen), styleLine);


//Plot(Ref(UpFractal,2), "Up Fractal", ParamColor("Up Fractal Color",colorRed),8);
//Plot(Ref(DownFractal,2), "Down Fractal",ParamColor("Down Fractal Color",colorGreen),8);



/* 
for (a=4;a= H[a-4]) AND
(H[a-2] >= H[a-3]) AND
(H[a-2] >= H[a-1]) AND
(H[a-2] >= H[a]))
PlotText("PH: \n"+H[a-2], a-2, H[a-2], colorGreen);

if ((L[a-2] <= L[a-4]) AND
(L[a-2] <= L[a-3]) AND
(L[a-2] <= L[a-1]) AND
(L[a-2] <= L[a]))
PlotText("PL: \n"+L[a-2], a-2, L[a-2]-dist[a-2], colorRed);
}

*/


tchoice=Param("Title Selection ",2,1,2,1);

Q=Param("% Change",0.2,0.1,10,0.1);
Z= Zig(C ,q ) ;
HH=((Z Ref(Z,-2)) AND (Peak(z,q,1 ) >Peak(Z,q,2)));
LH=((Z Ref(Z,-2)) AND (Peak(Z,q,1 ) Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) >Trough(Z,q,2)));
LL=((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 )  (PH+(room*PH));

initialStopBuy=Ref(PL,2)-(Ref(PL,2)*room/100);
trailStopBuy=IIf(C>PH,Ref(initialStopBuy,-1),initialStopBuy);

newStopBuy=trailStopBuy;

BuyLimitCapital=int(Capital/C);
SLbuy=round(C-initialStopBuy);
BuyLimitSL=int((Capital*drawdown)/(100*SLbuy));

//Condition for sell : Exit when previous pivot low is cracked.
Sell = C< (PL-(room*PL));

Buy = ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);

Short = Sell;
Cover = Buy;

Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );


_SECTION_END();
// ichamuku line
SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
Plot(SL,"SL",colorWhite,styleThick); // standard, base, or kijun-sen line
Plot(TL,"TL",colorYellow,styleThick); // turning, conversion, or tenkan-sen line


//=======price

Color_buy = IIf(Close > SL AND Close > TL,colorBlue,IIf(Close < SL AND Close < TL,colorRed,colorYellow));
PlotOHLC( Open, High, Low, Close, "", Color_buy, styleBar+styleThick ); 

rng = PH-PL;
key = PH - (rng/2);
tgt_long2 = ph+rng*2.618;
tgt_long1 = ph + rng*1.75;
ret1 = ph-rng*0.382;
ret2 = ph-rng*0.612;
tgt_short1 = PL - rng*1.75;
tgt_short2 = PL-rng*2.618;
risk_long = Close - SL;
risk_short = SL-Close;

_SECTION_BEGIN("Volume"); 
Vol_col = IIf(Volume > MA(Volume,10) AND C > MA(C,10),colorGreen,IIf( Volume > MA(Volume,10) AND C < MA(C,10),colorRed,colorGrey40));
Plot( Volume, "Volume", Vol_col, styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 5 );


 Title = EncodeColor(colorWhite)+ "LINKON'S PIVOT SYSTEM" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "+"\n" +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+"  "+ "Cl-"+C+"  "+ "Vol= "+ WriteVal(V)
+ EncodeColor(colorAqua)+ WriteIf (Color_buy ==colorBlue , "\n Stay LONG with a stop loss of  : "+SL+"  ___Risk of :"+risk_long,"")
+ EncodeColor(colorRed) + WriteIf (Color_buy ==colorRed  , "\n Stay SHORT with a stop loss of : "+SL+"  ___Risk of :"+risk_short,"")
+ EncodeColor(colorYellow)+ WriteIf (Color_buy ==colorYellow  , "\n Trend NOT CLEAR : stopline is at :"+SL,"")
+ "\n"
+ EncodeColor(colorGreen)+ "\n Long 2nd target :"+ tgt_long2
+ EncodeColor(colorGreen)+ "\n Long 1st target :"+ tgt_long1
+ EncodeColor(colorAqua)+ "\n Place Upper Trigger at :"+PH
+ "\n"
+ EncodeColor(colorYellow)+ "\n keylevel :"+ key
+ "\n"
+ EncodeColor(colorAqua)+ " \n Place Lower Trigger at :"+PL
+ EncodeColor(colorRed)+ "\n Short 1st target :"+ tgt_short1
+ EncodeColor(colorRed)+ "\n Short 2nd target :"+ tgt_short2;

Open chat
1
Hi, how can I help you?