Topics
27 Nov 2013, 00:15
 5792
 6
Replies

Ravadre
27 Nov 2013, 21:16

RE:

Hyperloop said:

Slippage in double means you can set it to a fraction of pips. Ex) 2.1 pips, 1.0 pips, etc.

Great, so surprisingly this gives more possibilities than "old api" and cTrader as well.

Thanks.


@Ravadre

Ravadre
27 Nov 2013, 19:12

Thank you for your answer.

Do you maybe know the answer to my last question?

However, when using ExecuteMarketOrder, you ought to pass a double, does that mean I should do some sort of conversion (slippageInPips * PipSize)?

I am still now sure how I should interpret difference in how slippage is passed between those 2 methods (int? in one, double? in the other). Theoretically, I we assume that ExecuteMarketOrder slip parameter expects double in 'price format' (for example, 0.0001 represents 1 pip) I could pass slippage as low as 1/10th of a pip (by passing 0.00001), which is smaller value than what I could get using old API (filling MarketOrderRequest) or through cTrader's GUI, which would be strange.

For the reference, I've also tested if Symbol.Ask/Bid could change between reading it once and calling ExecMarketOrder and the answer is no, as long as we are not doing this on our own thread (we have to block execution in OnStart, OnTick, OnBar).

So this code:

while (r)
{
   Print("Ask: " + Symbol.Ask);
   System.Threading.Thread.Sleep(300);
}

will return the same result when called directly from OnTick, but will update properly if called from our Thread (which means, theoretically, entry2 and entrya from my OP could differ).


@Ravadre