molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Sun May 19, 2024 2:31 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: indicator won't draw a line when attached to a chart
PostPosted: Sat Oct 15, 2011 11:43 am 
Offline

Joined: Sat Oct 15, 2011 11:05 am
Posts: 7
Attachment:
File comment: The STOCH-RSI indicator .
Raw%K-StochRSI.moi [1.76 KiB]
Downloaded 402 times
Hi, i built a custom indicator to calculate the stochastic of RSI values i.e a STOCH-RSI indicator, but to my surprise only the values were printed but the line was not drawn when i attached it to a chart, and this after the indicator builder had confirmed that the custom indicator was okay before the code was generated. The formula for the indicator is given as

Current value of RSI - Lowest value of RSI(for 13 periods) / Highest value of RSI(13 PERIODS) - Lowest value of RSI(13 PERIODS).
I have attached the .MOI files for examination. Thanks


Attachments:
File comment: The lowest value of RSI-14 for the last 13 bars, current bar inclusive
lowestlowRSI.moi [1.49 KiB]
Downloaded 386 times
File comment: The highest value of RSI-14 for the last 13 bars, current bar inclusive
highesthighRSI.moi [1.5 KiB]
Downloaded 376 times
Top
 Profile  
 
 Post subject: Re: indicator won't draw a line when attached to a chart
PostPosted: Sun Oct 16, 2011 9:31 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Good idea to divide the calculation.
iCustom(NULL,0,"lowestlowRSI",1,i) should be iCustom(NULL,1,"lowestlowRSI",1,i)
When the indicator generates the signals it tells you the mode:(pay attention when you click on generate)
//***Read this first: Integration with Molanis Strategy Builder***
/*To integrate this indicator with Molanis Strategy Builder use the following modes:
Mode 1 = Lowest of iRSI(NULL,0,14,PRICE_CLOSE,i) with period 13;
Thus change the mode for both (Mode 0 gives you the plain indicator value - mode 1 gives you the lowest value)


Top
 Profile  
 
 Post subject: Re: indicator won't draw a line when attached to a chart
PostPosted: Sun Oct 16, 2011 11:48 am 
Offline

Joined: Sat Oct 15, 2011 11:05 am
Posts: 7
Thanks but i used mode=1 in the calculations already, so i got the mode right because i read the comments at the top concerning the mode before using the icustom indicator . But what you told me to do changing from icustom(null,0,lowestlow.......) to icustom(null,1,lowestlow.......) would only change the time period from current chart period ( value of 0) to 1 which is the 1 minute timeframe,but the 1hr timeframe is what i want to use and it is currently what i'm using on my charts so the value "0" which represents current chart period takes care of that. So i'ld like you to have another look at it and tell me what the problem really is.What makes it really difficult for me is that it calculates and displays the indicator values correctly and the builder is telling me that it's okay, but i don't understand why it won't draw the line, that is where the problem is............. drawing the line. Thanks.


Top
 Profile  
 
 Post subject: Re: indicator won't draw a line when attached to a chart
PostPosted: Mon Oct 17, 2011 8:52 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
You are right.
iCustom(NULL,0,"lowestlowRSI",1,i) is fine.
When you divide by indicators you may have cases where you divide by zero so an error is generated and the indicator won't print.
The solution is to add a number that won't affect the calculation:
... /(0.0000000000001+iCustom(NULL,0,"highesthighRSI",1,i)-iCustom(NULL,0,"lowestlowRSI",1,i)
Also, it is better to multiply by 100 instead of 1000000 to have a lower scale.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009