Help With using variables (I think)
-
https://fxdreema.com/shared/0kx4JMcie
First off. Brilliant site here! Love it!
Sharing my project. I have gotten it to work well in testing up until I wanted to add a condition to each side of the main algo area. I looped in blocks 36,38,39&40. What I am trying to do is allow a buy or a sell only if the distance between the current price and a moving average is less than the ATR14 value. What I did is set up two variables. BLDistBuy and BLDistSell. I am using blocks 36 & 39 to populate the variables so I can use them in the calculations in blocks 38 & 40. Trouble is, when I test it it appears not to work. If I take out my variable loops (blocks 36,38,39 & 40) the EA runs just fine. When I keep the variable loop in - no trades trigger. I am SURE I am doing something wrong
and have looked through a crapload of posts to try to figure this out. I would really appreciate if someone could let me know what I am missing here.Thanks in advance!
-
@johnkscott4781 Hi. i changed your blocks. but you used Buy variable (BLDistBuy) for sell blocks
im not sure that working perfectly
i think you have some issue as well
just try now
https://fxdreema.com/shared/0kx4JMcie -
Thank you Xfire! I really appreciate it.
Simple stuff gets missed hahaha! I based on what you posted I revised my project. I did indeed have wires crossed on the buy and sell variable. Copy and pasted and didn't revise. Oops! I made corrections and I still can't seem to get it to work the way I envisioned. It will not initiate and buys or sells. I must have something conflicting. Like I said above, if I take that variable loops out it executes just fine. So I've got something wrong here.
Updated project link https://fxdreema.com/shared/EJHgQxqOc
Thanks again!
-
Is this the whole project or just a part of it?
-
Hi. This is the whole project. So far. I have a couple more components to add (this variable question being part one of them). I have been building one component at a time and back testing as I go to see what helps and what doesn't. I would say this is 80% complete to what I am envisioning.
Eventually I will likely substitute different components in and out to find a combination that works "best". But the guts of the logic won't change. Just the actual indicators that make up the conditions.

-
The only thing I can recomend you now is dividing up the project into smaller parts and then test them separatedly. Maybe you will find the issue that way.
-
Hi. Thanks for your help. I just sorted the issue. I found a beautiful little block called Check Distance which I had not previously seen. Works brilliantly for this!