Jump to content
  • 0

ATR stop loss with specified Start date and Price


Capind

Question

Hi

I have a ATR stop loss indicator that works fantastic in Metastock, and i want to know if anyone can assist me to re-code it for Prorealtime?

ATR Stop Long

 

InpMonth:=Input("Month",1,12,1);

InpDay:=Input("Day",1,31,2);

InpYear:=Input("Year",1800,2050,2020);

InitStop:=Input("Initial Stop Price",0.1,20000,10);

atrper:=Input("ATR period :",1,100,5);

atrfact:=Input("ATR multiplication :",1,10,2);

loss:=atrfact*ATR(atrper);

EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();

EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);

support:=C-loss;

TrailStopLong:= If(EntryLock=0 OR EntryLong=1,InitStop,

If(support>Ref(Support,-1),Max(support,PREV),PREV));

TrailStopLong

 

ATR Stop Short

 

InpMonth:=Input("Month",1,12,1);

InpDay:=Input("Day",1,31,2);

InpYear:=Input("Year",1800,2050,2020);

InitStop:=Input("Initial Stop Price",0.1,20000,10);

atrper:=Input("ATR period :",1,100,5);

atrfact:=Input("ATR multiplication :",1,10,2);

loss:=atrfact*ATR(atrper);

EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();

EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);

support:=C+loss;

TrailStopShort:= If(EntryLock=0 OR EntryLong=1,InitStop,

If(support>Ref(Support,-1),Min(support,PREV),PREV));

TrailStopShort

Link to post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...