Hi Support Team
Hope you can help. I have a code which from time to time have a negative value which stop my strategy in Pro Order.
The one code is:
indicator1=(close-average[10](close))
indicator2=(average[10](close-average[10](close))
c1=(indicator1>indicator2)
c2=(indicator1<indicator2)
The problem is when the close/price is below the average then the indicator1 returns a negative value which also means indicator2 will be negative, crossing the zero line. I use it as a bearish or bullish indicator the same as a using close>average[10](close) as bullish.
What can I do for the builder to accept the > or < even if the are negative for example if:
indicator1 = -5 and indicator2 = -10 then c1 remains true even if the values are negative without pro order stopping the strategy?
The second code is:
indicator1=volume
indicator2=(high-low)
c1=(indicator1/indicator2)
So when the volume = 0 then Pro Order stops. So what I did is:
If indicator1 < 1 Then
indicator1 = 1
Else
indicator1 = volume
endif
So that the calculation continues even when volume = 0. This do not seem to work. Works fine in backtest and demo but not live. Hope you can help?
Johann – Please re-read the forum rules before posting again and always use the ‘Insert PRT Code’ button when ever you are putting any code in your posts. I have tidied up your post for you – we like a tidy forum! 🙂
Hi Vonasi
Apologies did not even know how to use the insert function, but i will find out and use it in future. Thank you. Also do you have a potential solution to my problem?
My suggestion would be to only allow the code to run if volume <> 0
if volume <> 0 then
//your entry conditions and orders here
endif
Thank you Vonasi will try, and any suggestion on the the first code, I try to do the insert code but it does not look the same as yours, sorry!
indicator1=(close-average[10](close))
indicator2=(average[10](close-average[10](close))
c1=(indicator1>indicator2)
c2=(indicator1<indicator2)
I presume that when the close is below the average[10] or when it crosses over, the value returned is either zero or a negative value which is probably why it stops?
Hi Vonasi, just realized I could try the same suggestion you gave:
If indicator <> 0 Then