Can some kind person tell me where I am wrong? - page 2

 
So you want to check if green > 2.0 * red ? where are you getting the green and red values ? are they the 2 iCustom calls ? if they are then your code looks wrong . . .
 

I am getting both values from the closed bar for Buffer 0 and Buffer 1. The test is the difference between Green - Red being > 2 * the value of Red (on the LONG side)

e.g if Green = 0.0036 and Red = 0.0008 the difference is 0.0028 and this is > 2 * 0.0008

For the SHORT side it tests Difference Red - Green being > 2 * the value of Green

e.g if Red = 0.0036 and Green = 0.0008 the difference is 0.0028 and this is > 2 * 0.0008

It "seems" to be working correctly but I could not get it to print to screen so have been relying on it working as intended. But I have experienced this before thinking all was correct and then found out much later my logic or method was seriously flawed (like when I used int instead of double one time)

 
NewtonLeo:

I am getting both values from the closed bar for Buffer 0 and Buffer 1. The test is the difference between Green - Red being > 2 * the value of Red (on the LONG side)

That isn't what you said a couple of posts back . . .

"My trigger to open an order is when the value of Green bars is numerically greater than 2 times the Red bar" i.e. green > 2.0 * red

What you have mentioned above, Green - Red being > 2 * the value of Red, can be simplified to green > (factor +1) * red

If you want to see what your values are you can use Print to send them to the Experts/Journal tab or use Comment to put them on the screen top left.

 
NewtonLeo:
it's iCustom(NULL, 0, "IndiName",12,0,1) NULL is the current symbol, 0 for current timeframe, 12 period, Buffer 0, Closed candle.

I managed to print the values to the screen so the indicator settings are working. A typical result is 0.0012 so it's a double if I understand correctly. I am trying to get around having to use new values when a JPY pair is involved; hence I'm trying to use ratios.

The only thing I can't verify is if my formula is working because I'm not proficient at where and how to place the print to log. The EA works in strategy testing but I have never read about how to use the magnitude check for one value x being > * times the other

ie.
Does this help clarify? I appreciate any input here as I have "L" plates on


To know if it is valid code you have to know what type the parameters are you are using

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)  
iCustom(NULL, 0, "IndiName",12,0,1)

NULL is the current symbol So like "EURUSD" that means NULL is a 'string'

The 1 is here bettter definied as bar number 1 then it is closed bar you can here have also an input of 6 that means the value of the indicator at bar 6

The current bar is bar 0

 
RaptorUK:

That isn't what you said a couple of posts back . . .

"My trigger to open an order is when the value of Green bars is numerically greater than 2 times the Red bar" i.e. green > 2.0 * red

What you have mentioned above, Green - Red being > 2 * the value of Red, can be simplified to green > (factor +1) * red

If you want to see what your values are you can use Print to send them to the Experts/Journal tab or use Comment to put them on the screen top left.

Raptor, Thank you for this. I should explain I have a concentration issue which is residual from getting Post-traumatic Stress Disorder (PTSD) several years ago. I hate it.

My mind can understand a thing but when it comes to explaining it, if I get it wrong, I am oblivious to my error. This is why I have re-edited my post after you picking-up on error(s), or me spotting them later. So I ask your understanding of this and thank you sincerely for your patience with me. Your solution is (now) obvious to me and I am kicking myself for not thinking of this solution earlier. Thanks Raptor

** Have made the changes suggested and it works :-) **
 
NewtonLeo:

Thanks Raptor

You are most welcome, happy to help if I'm able :-)
 
deVries:


To know if it is valid code you have to know what type the parameters are you are using

NULL is the current symbol So like "EURUSD" that means NULL is a 'string'

The 1 is here bettter definied as bar number 1 then it is closed bar you can here have also an input of 6 that means the value of the indicator at bar 6

The current bar is bar 0

DeVries, thankyou too for for your help. I am learning new things thanks to people like you.
Reason: