Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
kthakker0  
#1 Posted : Monday, June 11, 2012 12:34:05 AM(UTC)
kthakker0

Rank: Member

Groups: Registered, Registered Users
Joined: 5/8/2010(UTC)
Posts: 26

KPL Swing Indicator for Metastock

no:=Input("Swing/ Bars",1, 20, 2);
res:=HHV(H,no);
sup:=LLV(L,no);
HLd:=If(CLOSE>Ref(res,-1),
{then}1,
{else}If(CLOSE<ref(sup,-1),
{then}-1,
{else}0));
HLv:=ValueWhen(1,HLd0,HLd);
HiLo:=If(HLv=-1,
{then}res,
{else}sup);
HiLo;

The above is the Swing indicator which is plotted directly on Metastock chart

Originally the indicator is plotted in one color.

I want a code to change the indicator color to Red when the Close is below the indicator and again the color should change to Blue when stock trades above the Close.

Please can any help me with the required code which changes color as per the requirement.
mstt  
#2 Posted : Monday, June 11, 2012 3:18:57 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 7/25/2005(UTC)
Posts: 847

Was thanked: 1 time(s) in 1 post(s)
Hi Kshetij

Can you repost the code using the appropriate tags to prevent the code from being corrupted? Any recent post by Wabbit includes information on how to do that.

Is the indicator to be plotted as a histogram or a line? Histograms are easy to colour, but lines range from difficult to impossible depending on the style.

Roy

henry1224  
#3 Posted : Monday, June 11, 2012 4:29:26 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/29/2004(UTC)
Posts: 1,383

this is the code in amibroker

Code:

/* my entry is very simple(daily data for trading) kpl system for entry only & exit as follow: 1 st exit at x % from entry price only 1/3 quantity.(ie 1st profit target)2 nd exit when exit Signal comes from kpl sys remaining 1/3 quantity.3. scale-in to initial quantity if new kpl Buy Signal comes.re-do above scaling-out & scaling-in till filal exit.4. final exit all quantity when Close below 21 Day EMA. kpl system code bellow :*///AFL by Kamalesh Langote. Email:kpl@...no=Param( "Swing", 2, 1, 55 );tsl_col=ParamColor( "Color", colorCycle ); res=HHV(H,no);sup=LLV(L,no);avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));avn=ValueWhen(avd!=0,avd,1);tsl=IIf(avn==1,sup,res);Buy=Cross(C,tsl) ;Sell= Cross(tsl,C) ; Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase);shape=Buy*shapeUpArrow + Sell*shapeDownArrow;PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));SetPositionSize(300,spsShares);ApplyStop(0,1,10,1);



mt4eas  
#4 Posted : Saturday, August 25, 2012 12:19:07 AM(UTC)
mt4eas

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 3/12/2012(UTC)
Posts: 2

This is Ravi_swing indicator and posted by me in Traderji. It is not KPL Swing. If you would have asked me then i will help. Sorry friend.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error