Download MetaTrader 5

disable trading if spread is too wide

To add comments, please log in or register
ycomp
279
ycomp  
How can I disable trading if spread is too wide?
honest_knave
Moderator
2336
honest_knave  

Before your EA trades, get it to check 

SymbolInfoInteger(Symbol(),SYMBOL_SPREAD)
whroeder1
15561
whroeder1  
ycomp: How can I disable trading if spread is too wide?
  1. Get the spread
  2. Compare against "too wide"
  3. Ignore the tick.
What's the problem?
if( SymbolInfoInteger(Symbol(),SYMBOL_SPREAD) > 50 )
if(        MarketInfo(Symbol(),  MODE_SPREAD) > 50 )
if( Ask - Bid                                 > 50 * _Point)
if( Ask - Bid                                 >  5 * pips2dbl)
ycomp
279
ycomp  
WHRoeder:
ycomp: How can I disable trading if spread is too wide?
  1. Get the spread
  2. Compare against "too wide"
  3. Ignore the tick.
What's the problem?

ah, sorry I wasn't specific enough...

I meant I wanted to know how to disable manual trading. Kind of like to prevent stupid costly mistakes that I've done a few times, like entering a trade when it is much wider than normal.

honest_knave
Moderator
2336
honest_knave  

Show both the ask and bid lines on your chart.

Show the spread in Comment().

Draw a large colored OBJ_LABEL displaying the spread or a message "No trades!"

Add buttons to your chart to place your trades, rather than the usual interface. Code the spread check into those.

Lots of possibilities. 

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Hand build guides are just nice to have. :)
To add comments, please log in or register