• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 8:45pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 8:45pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

function to draw array on chart? 1 reply

Two Dimensional Array vs One Dimensional Array 13 replies

How do return an array from a function? 2 replies

How to make a function to output an array? 5 replies

Calculate Stochastic Formula on a array (non indicator buffer array) 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 4
Attachments: RSI on 2 Moving Averages' Difference (pass Array to Function)
Exit Attachments
Tags: RSI on 2 Moving Averages' Difference (pass Array to Function)
Cancel

RSI on 2 Moving Averages' Difference (pass Array to Function)

  • Post #1
  • Quote
  • First Post: Edited Nov 20, 2019 5:59pm Nov 18, 2019 6:08pm | Edited Nov 20, 2019 5:59pm
  •  okanemochi
  • Joined Jan 2015 | Status: Member | 25 Posts
Hi guys,

@@UPDATE:
I have overcome the indicator display problem and now get the indicator worked as expected. I also add the 'trending' component into the MaRS to identify the trend up/ trend down of the MaRS (i.e. comparing the current value of MaRS with the average value of MaRS of the last x bars). The only problem I have is that the indicator (file:
Attached File(s)
File Type: mq4 AutoAdjust_MA_RelativeStrength Working-but-need-optimized.mq4   10 KB | 68 downloads | Uploaded Nov 20, 2019 5:57pm
) seems taking a long time to load whenever I drop it on the chart. Can any one take a look at my code and suggest any optimization to help my indicator load faster. Thanks

Attached Image (click to enlarge)
Click to Enlarge

Name: Screenshot1.png
Size: 62 KB


Andre
----------------------------------------------------
I am writing an indi on 2 Moving Average-cross and compute the Relative Strength Index (RSI) on the difference between these MAs. Basically, it will measure the oscillation of the "Difference" between MovingAverage1 and MovingAverage2 (MaDiffRS). The mq4 files is attached. The idea is to compute the 2 MAs and start computing the RSI when the counter [i] pass over the RS's period (InpTIMEFRAME_RS) (start using the function MAValidatorChk).

I got stuck at getting the MaDiffRS at it returns no value on the terminal. Can you check and advise what is wrong. I believe it may be caused by passing the MaLine1Buffer and MaLine2Buffer arrays into the function MAValidatorChk incorrectly but not sure.
Attached Image (click to enlarge)
Click to Enlarge

Name: Screenshot2.png
Size: 48 KB
Attached File(s)
File Type: mq4 AutoAdjust_MA_RelativeStrength.mq4   9 KB | 91 downloads
  • Post #2
  • Quote
  • Nov 19, 2019 4:11am Nov 19, 2019 4:11am
  •  j11
  • | Joined Jun 2016 | Status: Member | 95 Posts
You are passing '0' to AverageNegMADiff & AveragePosMADiff

On quick look could not work out why, sorry.

If You change the else MANegDiff_array[i] = 0 & else MAPosDiff_array[i] = 0 to 0.01 the line will appear so think you need to check there first.

For some reason if(MADiff_array[i]<0) MANegDiff_array[i] = 1;
is not returning correct value.

If you solve it please let me know what the issue was.
If it was easy then I would do it !!
 
 
  • Post #3
  • Quote
  • Nov 19, 2019 4:24am Nov 19, 2019 4:24am
  •  ionone
  • | Commercial Member | Joined Oct 2014 | 440 Posts
i think this is the problem
in MT4, 0 is the most recent value
i think you got this confused.
if(limit>=InpTIMEFRAME_RS && i>=InpTIMEFRAME_RS)
 
 
  • Post #4
  • Quote
  • Last Post: Nov 20, 2019 5:56pm Nov 20, 2019 5:56pm
  •  okanemochi
  • Joined Jan 2015 | Status: Member | 25 Posts
Thanks @ioone and j11 for your sharp eyes
 
 
  • Platform Tech
  • /
  • RSI on 2 Moving Averages' Difference (pass Array to Function)
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023