Using Bid.....

 

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

 
forexman05:

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.

 
Irtron:

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

 
cloudbreaker:

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.

 
23510:

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.

 
cloudbreaker wrote >>

Yep, absolutely right.

Thanks everyone for your feedback....that is exactly what I needed-I always forget that it is very probable that MA will not equal bid exactly!

Reason: