help coding indicator retrieving data from different chart

Back to topics list To post a new topic, please log in or register
avatar
1
forexmangumopus 2016.04.23 15:57
 

 I have been trying to calculate a variable which takes iLow data from EURUSD but running into obstacles. Anybody have an idea how I could properly do this?

I'm not an expert programmer, so constructive criticism please, no disparaging comments.

 

 

 

  variable1 = -100 *(highClose*highClose - (Low[iLow(EURUSD, 0, shift)]) ;
  return (vol);
avatar
1197
FMIC 2016.04.23 17:39 #
 
// Code removed due to my mistake of having confused "iLow" with "iLowest"
  1. You have unbalanced parenthesis which will cause a compile error.
  2. I am assuming that EURUSD is a variable name and not just text otherwise it should be "EURUSD" and not EURUSD.
  3. Consider using _Symbol, instead of EURUSD if you are calculating against the current chart data.
  4. Use PERIOD_CURRENT instead of "0" for better readability.
  5. Use "100.0" instead of "100" to guarantee floating point arithmetic instead of integer arithmetic. In this case, since it is multiplication, it is not a problem. But in other cases, such as division, it could be a problem, so get into the habit of using the correct format.
  6. EDIT: removed due to my mistake of having confused "iLow" with "iLowest"
  7. EDIT: removed due to my mistake of having confused "iLow" with "iLowest"
  8. EDIT: removed due to my mistake of having confused "iLow" with "iLowest"
  9. In your code, you calculate "variable1" but are returning the variable "vol". Is that correct? Without more code, we cannot say if it is correct or not.

Other than that we cannot really help you much, if you don't explain what the problem is. We cannot read you mind and cannot guess what is meant by "running into obstacles"!

PS! Always use the SRC button to add code to your post. Don't simply add it as normal text.


avatar
12984
WHRoeder 2016.04.23 18:52 #
 
forexmangumopus I have been trying to calculate a variable which takes iLow data from EURUSD
variable1 = -100 *(highClose*highClose - (Low[iLow(EURUSD, 0, shift)]) ;
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. The Predefined Variables - MQL4 Reference are the current chart only.
  3. iLow - Timeseries and Indicators Access - MQL4 Reference returns a price
  4. What do you think Low[1.23456] returns?
  5. Do not assume the shift on the current chart matches the shift on another. iBarShift - Timeseries and Indicators Access - MQL4 Reference
  6. Are you sure you want it from EURUSD even if you are on another chart?
avatar
1197
FMIC 2016.04.23 19:24 #
 
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. The Predefined Variables - MQL4 Reference are the current chart only.
  3. iLow - Timeseries and Indicators Access - MQL4 Reference returns a price
  4. What do you think Low[1.23456] returns?
  5. Do not assume the shift on the current chart matches the shift on another. iBarShift - Timeseries and Indicators Access - MQL4 Reference
  6. Are you sure you want it from EURUSD even if you are on another chart?
Thanks for pointing out the "iLow" thing. In my haste to help, I confused "iLow" with "iLowest". I will amend my post to correct the issue!
Back to topics list  

To add comments, please log in or register