Hello everyone in FF,
I am trying to work on something and I am having difficulty.
I would like to be able to figure out the spread and use that as a condition as to whether or not enter a trade.
When I use the following code within a program...it does calculate and display the correct spread on my chart......
======================================================
String Display = "";
Double spread = (Ask - Bid) *10000;
Display = "current spread is: " + DoubleToStr(spread,1);
if (rsi_a > 50 && spread <= 5) Order = SIGNAL_BUY;
if (rsi_b < 50 && spread <= 5) Order = SIGNAL_SELL;
Comment(Display);
======================================================
The problem is that with the above code....no trades will take place.
However...once I remove the "spread <= 5" portion of the code....it trades just fine.
Does anyone know what the problem is? I simply want to establish what the current spread is and then build that in to my condition so as not to trade when the spread exceeds a certain limit.
Thanks in advance for any help with this.
I am trying to work on something and I am having difficulty.
I would like to be able to figure out the spread and use that as a condition as to whether or not enter a trade.
When I use the following code within a program...it does calculate and display the correct spread on my chart......
======================================================
String Display = "";
Double spread = (Ask - Bid) *10000;
Display = "current spread is: " + DoubleToStr(spread,1);
if (rsi_a > 50 && spread <= 5) Order = SIGNAL_BUY;
if (rsi_b < 50 && spread <= 5) Order = SIGNAL_SELL;
Comment(Display);
======================================================
The problem is that with the above code....no trades will take place.
However...once I remove the "spread <= 5" portion of the code....it trades just fine.
Does anyone know what the problem is? I simply want to establish what the current spread is and then build that in to my condition so as not to trade when the spread exceeds a certain limit.
Thanks in advance for any help with this.