Download MetaTrader 5

Refreshrates()

To add comments, please log in or register
Viffer
614
Viffer  

Could someone explain what is happening with refresh rates... the documentation hasn't really answered my query.

Suppose I send an order and get Err 129 Invalid Price. My way out of the error is refresh rates...

What happens after you've refreshed? I understand that tick info is updated but what does the program do with that?


Does it pick up where it left with the error and automatically resend the order?

Or, do we have to re send the order after refreshing? (presumably we would need to loop this order until it's done)

Or does it go back to start?(That would be pretty pointless so I assume not).


Thoughts appreciated.

V

Nikolay Panev
1088
Nikolay Panev  
Viffer:

Could someone explain what is happening with refresh rates... the documentation hasn't really answered my query.

Suppose I send an order and get Err 129 Invalid Price. My way out of the error is refresh rates...

What happens after you've refreshed? I understand that tick info is updated but what does the program do with that?


Does it pick up where it left with the error and automatically resend the order?

Or, do we have to re send the order after refreshing? (presumably we would need to loop this order until it's done)

Or does it go back to start?(That would be pretty pointless so I assume not).


Thoughts appreciated.

V

You can try using RefreshRates() just before executing your trade.

It is not doing any other actions, so you need to resend your orders or implement some other retry mechanism.

gordon
2326
gordon  
U only need to use RefreshRates() if u r using any one of the predefined variables. Calling RefreshRates() will update these variables with the current value (the value received from the last incoming tick). This might or might not have to do with your error 129.
cameo
476
cameo  

Viffer, 

afaik, RefreshRates() only make sure that your terminal gets the latest price in case an EA calculates decision too long & misses a tick / flurry of ticks.  

This script from codebase handles error with that function very well. Kudos to the coder. 

Viffer
614
Viffer  
robofx.org:

You can try using RefreshRates() just before executing your trade.

It is not doing any other actions, so you need to resend your orders or implement some other retry mechanism.


Thanks, yes, I agree refresh prior to send will cut out most of the issues and if ti still fails coding retry makes sense... I have seen a lot of code examples around for error handeling that just uses refresh rates but then doesn't do anything else which threw me a bit. thanks for your answer.

V

Viffer
614
Viffer  
cameofx:

Viffer,

afaik, RefreshRates() only make sure that your terminal gets the latest price in case an EA calculates decision too long & misses a tick / flurry of ticks.

This script from codebase handles error with that function very well. Kudos to the coder.


Thanks for the link... yes, that's pretty much what I though needed to happen, I had just seen it so often with no further action that I wondered if it was doing something else.
Viffer
614
Viffer  
gordon:
U only need to use RefreshRates() if u r using any one of the predefined variables. Calling RefreshRates() will update these variables with the current value (the value received from the last incoming tick). This might or might not have to do with your error 129.


Thanks Gordon, good to know... I am using 129 as an illustration, but now you've got me thinking about what 129 actually means....assuming that my coding delivers the correct price to ordersend() and is successful most of the time. Other than refreshing in a fast market, are there other reasons for 129 I should be aware of?

V

cloudbreaker
1577
cloudbreaker  

Another reason for 129 would be supplying the price without it being normalized to the correct number of decimal places. The Ask and Bid inbuilts for the current symbol are pre-normalized.

CB

JC
1499
JC  
cloudbreaker:

Another reason for 129 would be supplying the price without it being normalized to the correct number of decimal places.

Not sure about that. If I try the following:

   double UsePrice = Ask + (Point / 2);
   OrderSend(Symbol(), OP_BUY, 0.1, UsePrice, 10, 0, 0); 

...then I get error 4107, not 129.

Viffer
614
Viffer  
cloudbreaker:

Another reason for 129 would be supplying the price without it being normalized to the correct number of decimal places. The Ask and Bid inbuilts for the current symbol are pre-normalized.

CB


cool, thanks CB
gordon
2326
gordon  
cameofx:

afaik, RefreshRates() only make sure that your terminal gets the latest price...

No... It just updated the predefined variables with the latest price. It does not cause the Terminal to get the latest price.
12
To add comments, please log in or register