Download MetaTrader 5

disable trading if spread is too wide

To add comments, please log in or register
The entire MQL5.community history on a single page!
ycomp
279
ycomp 2014.10.31 10:24 
How can I disable trading if spread is too wide?
honest_knave
Moderator
2213
honest_knave 2014.10.31 10:27  

Before your EA trades, get it to check 

SymbolInfoInteger(Symbol(),SYMBOL_SPREAD)
whroeder1
14514
whroeder1 2014.10.31 13:15  
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 2014.11.13 10:02  
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
2213
honest_knave 2014.11.13 10:33  

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 2014.11.13 12:40  
Hand build guides are just nice to have. :)
To add comments, please log in or register