Okay, this is driving me nuts! How can I get ordersend to work when bid equals a moving average!? Can anyone put the code here so I can figure this out! any help is much appreciated......
if(MarketInfo(Symbol(),MODE_BID)==MA)
{
OrderSend(Symbol(),OP_SELL,etc......
MA is my moving average value....apparently this is not written properly......
Thanks again! Dan
have you tried :
if(Bid>=MA) or if(Bid<=MA)
or if(Close[1]>=MA) or if(Close[1]<=MA)
Wrong!
Bid != Close[1]. Rather Bid == Close[0].
MA is double. Bid is fixed point. The probability of getting MA equal Bid is very very low.
It's like trying to catch an elevator at the very same level as a step at the staircase at an arbitrary time.
Perhaps you need some kind of approximation here. A threshold, epsilon, delta, tolerance, range, whatever that allows to reckon MA and Bid values 'equal'.
Use Bid.
eg.
if (Bid == MA)
{
do stuff
...
Tested and it works for me.
Wrong!
Bid != Close[1]. Rather Bid == Close[0].
MA is double. Bid is fixed point. The probability of getting MA equal Bid is very very low.
It's like trying to catch an elevator at the very same level as a step at the staircase at an arbitrary time.
Perhaps you need some kind of approximation here. A threshold, epsilon, delta, tolerance, range, whatever that allows to reckon MA and Bid values 'equal'.
I was providing an alternative to using Bid i was not saying Bid=Close[1]...thats impossible for the current bid to equal the closed value of the last candle...you yourself mentioned it is difficult to get Bid to equal an MA ...but using (Close[1]>= MA) is a valid way to confirm that price is over an MA....sorry for the confusion
Use Bid.
eg.
if (Bid == MA)
{
do stuff
...
Tested and it works for me.
this will not always work as the tick data might skip over the MA value...so Bid might be just below the MA value and then the next tick could be more than the MA ...so if(Bid>=MA) is more reliable.
this will not always work as the tick data might skip over the MA value...so Bid might be just below the MA value and then the next tick could be more than the MA ...so if(Bid>=MA) is more reliable.
Yep, absolutely right.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Okay, this is driving me nuts! How can I get ordersend to work when bid equals a moving average!? Can anyone put the code here so I can figure this out! any help is much appreciated......
if(MarketInfo(Symbol(),MODE_BID)==MA)
{
OrderSend(Symbol(),OP_SELL,etc......
MA is my moving average value....apparently this is not written properly......
Thanks again! Dan