logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
homano  
#1 Posted : Saturday, October 1, 2016 4:26:22 AM(UTC)
homano

Rank: Member

Groups: Registered Users, Subscribers
Joined: 8/19/2014(UTC)
Posts: 23

Thanks: 4 times

Hello,

How to get ( Now cross for the last 2 high Rsi(14)  ).

Your help Please,


UserPostedImage

Edited by user Saturday, October 1, 2016 4:28:11 AM(UTC)  | Reason: Not specified

mstt  
#2 Posted : Monday, October 3, 2016 12:28:02 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi homano The code I posted for you nearly 3 weeks ago could be adapted to do what you ask now. Rather than work with prices you'd need to work with RSI(), and you'd need to identify the last two peaks of RSI() (Highs with Lows before and after the Highs). Replacing the last line of code with "Cross(RSI(14),Line)" (without quotes) would allow the line to continue to last bar and signal a crossover point. Much of the earlier code will also need modification, but having a go at making the appropriate changes would teach yo much more than having me make the changes for you. I won't be able to look at it seriously for a couple of days. Roy
homano  
#3 Posted : Monday, October 3, 2016 3:43:22 AM(UTC)
homano

Rank: Member

Groups: Registered Users, Subscribers
Joined: 8/19/2014(UTC)
Posts: 23

Thanks: 4 times

Hi Roy,

Sorry,

Happening here is somewhat different

There may be one day or more between ( last 2 high Rsi(14)).

Here I do not know where the First peak (Rsi) will be and last peak also.

Thank you,

 

UserPostedImage

mstt  
#4 Posted : Monday, October 3, 2016 3:56:40 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi homano The code that I'm working on will hopefully identify peaks 1 and 2 and draw the green line automatically. I also want to signal RSI crossing above the green line (yellow line in your diagram), but for the moment I'm stuck with a technical issue that needs solving before I can proceed. Roy
homano  
#5 Posted : Monday, October 3, 2016 7:01:03 AM(UTC)
homano

Rank: Member

Groups: Registered Users, Subscribers
Joined: 8/19/2014(UTC)
Posts: 23

Thanks: 4 times


I am grateful to you ,,,

mstt  
#6 Posted : Tuesday, October 4, 2016 6:30:43 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi homano Here's a rough first effort and there may be some redundancy in the code as it stands. I did have thoughts of putting comments above each line of code but I think I've worked on it long enough for now. {High to High RSI Line w/Crossover} {Roy Larsen, 4/10/2016} Pds:=Input("HiRSI to HiRSI Line: RSI Periods",1,999,14); R:=RSI(Pds); RsiPks:=R>Max(Ref(R,-1),Ref(R,+1)); RsiPks:=ExtFml("Forum.Sum",RsiPks,1); CumPks:=Cum(RsiPks); TotPks:=LastValue(CumPks); Peak1:=CumPks=TotPks-1; Peak1:=Peak1*Alert(Peak1=0,2); Peak2:=CumPks=TotPks; Peak2:=Peak2*Alert(Peak2=0,2); BarDif:=LastValue(ValueWhen(1,Peak2,Cum(1))- ValueWhen(1,Peak1,Cum(1))); PkRs1:=R*Peak1; PkRs2:=R*Peak2; ConPk1:=LastValue(Highest(PkRs1)); ConPk2:=LastValue(Highest(PkRs2)); Change:=(ConPk2-ConPk1)/BarDif; Line:=ValueWhen(1,Peak1,R)+ Cum(Ref(Cum(PkRs1),-1)<>0)*Change; {Results} Line; 100*(Cross(Line,R) OR Cross(R,Line)); Hope this helps. Roy
thanks 1 user thanked mstt for this useful post.
homano on 10/4/2016(UTC)
homano  
#7 Posted : Tuesday, October 4, 2016 2:12:01 PM(UTC)
homano

Rank: Member

Groups: Registered Users, Subscribers
Joined: 8/19/2014(UTC)
Posts: 23

Thanks: 4 times

you are a genius 

Thank you Roy 


Best regards ,

Edited by user Tuesday, October 4, 2016 2:18:03 PM(UTC)  | Reason: Not specified

mstt  
#8 Posted : Wednesday, October 5, 2016 12:48:10 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi homano Thanks but I'm no genius - I think the result comes down to a little bit of inspiration and a lot of perspiration. I've added a little more code to to the indicator. The reason for this addition is so that the crossover marker (a single vertical histogram bar from 0 to 100) does not compress the scale of RSI when the "High to High RSI Line" indicator uses the same scale as the RSI. The last output deliberately generates an N/A result for the indicator, but "Line" and "Crossover" variables can still be accessed by an Exploration or Expert Advisor FmlVar("High to High RSI Line","Line") and FmlVar("High to High RSI Line","Crossover"). Creating a template with this indicator would probably minimize any setup problems such as having to fiddle with scale and appearance issues. Roy {High to High RSI Line} {Roy Larsen, 5/10/2016} Pds:=Input("HiRSI to HiRSI Line: RSI Periods",1,999,14); R:=RSI(Pds); RsiPks:=R>Max(Ref(R,-1),Ref(R,+1)); RsiPks:=ExtFml("Forum.Sum",RsiPks,1); CumPks:=Cum(RsiPks); TotPks:=LastValue(CumPks); Peak1:=CumPks=TotPks-1; Peak1:=Peak1*Alert(Peak1=0,2); Peak2:=CumPks=TotPks; Peak2:=Peak2*Alert(Peak2=0,2); BarDif:=LastValue(ValueWhen(1,Peak2,Cum(1))- ValueWhen(1,Peak1,Cum(1))); PkRs1:=R*Peak1; PkRs2:=R*Peak2; ConPk1:=LastValue(Highest(PkRs1)); ConPk2:=LastValue(Highest(PkRs2)); Change:=(ConPk2-ConPk1)/BarDif; Line:=ValueWhen(1,Peak1,R)+ Cum(Ref(Cum(PkRs1),-1)<>0)*Change; Crossover:=((Cross(Line,R)+ Cross(R,Line)) AND Cum(Ref(Peak2,-1)))*100; {Results} Line; Crossover; { N/A generated result below allows extremes } { of Crossover marker histogram style to use } { RSI scale while floating beyond RSI window } { extremities. } ValueWhen(1,0,0);
homano  
#9 Posted : Thursday, October 6, 2016 4:39:43 PM(UTC)
homano

Rank: Member

Groups: Registered Users, Subscribers
Joined: 8/19/2014(UTC)
Posts: 23

Thanks: 4 times

Thank you very much Roy.

mstt  
#10 Posted : Friday, October 7, 2016 3:51:05 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi homano I forgot to mention why the second line of the following two was a necessary inclusion in the indicator. RsiPks:=R>Max(Ref(R,-1),Ref(R,+1)); RsiPks:=ExtFml("Forum.Sum",RsiPks,1); To determine all RSI peaks (by looking for a high and testing for lower values before and after), I decided to use the Ref() function with plus and minus 1 parameters. This meant that the first RsiPks variable generated an N/A result on the the last data bar - a problem that would have persisted through the rest of the indicator. Happily the subsequent use of the Forum DLL changes the N/A value back to zero so that subsequent code would not be affected. I hope you will work your way through the indicator and get an understanding of what each variable does. Roy
Users browsing this topic
Guest (Hidden)
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.