Formula - calculating difference
-
Hi,
Can somebody tell me what I'm doing wrong in this configuration?
I'm trying to calculate the difference between "Kijun-sen line" and "Tenkan-sen line" and use that as an order entry condition.
https://fxdreema.com/shared/xAOZV0gLc



-
@rafaels919 What is your code doing? Does it not open any trades? Or in wromg direction?
-
@trader-philipps It opens trades, but it ignores the condition.
It is supposed to enter orders only when the difference between the two lines (line1 - line2) is greater than 0.0002 ticks or 2 pips.

-
@rafaels919 You didn't secify a candle ID such as ID1 as ID0 is the current candle and values may change during the candle is not closed. May that be the problem?
-
Alright, I had the values wrong. For a buy order, instead of (Kijun - Tenkan) I should've had (Tenkan - Kijun). The setup wasn't wrong. It works now.
Am just trying to get familiar with Constants and Variables. They seem to be crucial if one wants to be creative or test things quicker. @trader-philipps -
@trader-philipps After testing it carefully, it appears to be not working again...
Project link: https://fxdreema.com/shared/rJPfeS8ObI don't know what I'm doing wrong here, maybe someone could point me at the right direction?
- I'm selling when Tenkan (minus) Kijun difference is within 2 pips limit.
- And buying when Kijun (minus) Tenkan is within the same limit^.


-
Mayby better way would be this : put Tekan to Formula, in formula multiply Tekan ( Id1 ) x 1 and put it at variable. This same Formula make with a Kijun. In third Formula subtraction this two variables and put result to the third variable.
-
Hi @casebefx
I'm not sure if I fully understand what you described. Could demonstrate that in the project that I linked above?
That would be greatly appreciated. -
-
@casebefx What is the reason for multiplication *1 ?
-
@casebefx @trader-philipps Still doesn't work, it opens orders below and above the 2 pip limit, doesn't make sense:
https://fxdreema.com/shared/K2rBUELKc -
@rafaels919 I'd do like that - especially calculating in pips, so it should work on JPY pairs as well.
-
@trader-philipps That works well, thank you!