Download MetaTrader 5
To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
ycomp
45
ycomp 2014.10.31 10:24 
How can I disable trading if spread is too wide?
honest_knave
969
honest_knave 2014.10.31 10:27  

Before your EA trades, get it to check 

SymbolInfoInteger(Symbol(),SYMBOL_SPREAD)
whroeder1
13641
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
45
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
969
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