EA slippage

 

Hi Folks

How can i stop slippage with my EA, when a trade is triggered the entry point can be 4 pips away i have even seen 7 pips slippage, as i was testing demo EA developer stated must be slippage is there anyway i can correct this as is not worth using my EAs for trading as losing all my trades with the strategies i use.?


any advice welcome

thanks

 
use ecn account and better broker
 
  1. Do you really mean PIPs? PIP, Point, or Tick are all different in general.
              What is a TICK? - MQL4 programming forum (2014.08.03)

  2. Do you really mean slippage and not the spread?

    Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar). The charts show Bid prices only. Turn on the Ask line to see how big the spread is, Tools → Options (control+O) → charts → Show ask line.
 
martobrien1:thanks for the advice y'all
martobrien1:i checked the bid/ask prices aka spread have on the chart, the spread with IG is always 1 pip from 8am to 16.30 but still even on slow candles slippage is happening adding few pips on entry/exit even exiting a short is placing extra pips above where exit actually was? Could there be a technical problem with my broker as i used IG PRT and the same kept happening so i changed to mt4 but has got worse?
 
EA entry is entering trades at the end of a candle instead of at the beginning. How do i get the EA to recognise the candle opening and enter trade within 0.2 of a pip instead of 3 pips away, similar issues with exits? Any help would be good so i can resolve issues, as the EA entries and exits is ruining my day trading with particular strategy i use.
 
martobrien1:
EA entry is entering trades at the end of a candle instead of at the beginning. How do i get the EA to recognise the candle opening and enter trade within 0.2 of a pip instead of 3 pips away, similar issues with exits? Any help would be good so i can resolve issues, as the EA entries and exits is ruining my day trading with particular strategy i use.

int    g_lastReceivedBarCount;        // Used to keep track of number of bars and detect new bar arrival

int OnInit() { 
....
        g_lastReceivedBarCount = Bars(Symbol(), PERIOD_CURRENT);
....
}
void OnTick() {
....

        int currentBarCount = Bars(Symbol(), PERIOD_CURRENT);
	bool onFirstTickOfNewCandle = false;

        if (g_lastReceivedBarCount != currentBarCount)
        {
		onFirstTickOfNewCandle = true;
                g_lastReceivedBarCount = currentBarCount;
        }
....
}

Use onFirstTickOfNewCandle variable to regulate the entry to beginning of candle... If this doesn't work. keep track of ticks count using GetTickCount() function

 
sammcdj:

Use onFirstTickOfNewCandle variable to regulate the entry to beginning of candle... If this doesn't work. keep track of ticks count using GetTickCount() function  

thanks,Margaret

Thanks 


Margaret