Enormous Technical Problems - 5 Digit Broker Execution of Trades - Limit Orders same line or Order Modify second line - page 2

 
dabbler:
That is a minimum necessary test but frankly if you do it that way it is almost guaranteed to fail. There is no allowance for movement of the price when setting the trailing stop. You should ideally be at least several points away from the broker's stoplevel. 30 points on a 5 digit broker is only 3 pips; that's very tight. Perhaps you meant 30 pips and forgot to multiply that one by 10 like you did with all the rest.


Got it. That is the problem I am having. Boy I guess so. The 5 digit Broker code problem. I am sending you the code I have been using for it and some other one.

Also I am in need of as tight a trailing stop as possible. The EA I am using this for is on a 1m and 5m chart.What do you think the minimum for this would be to work.

Like your name and the picture is cool too.

JimsTradingMachine

Error I am getting is: OrderModify 130 many times on the journal.

Here is a recent trade that was made on the EURUSD. Notice it put in this
crazy stop loss digit number but seemed to ignore it and
apply the trailing stp. Ok. What's going on here? Do I need NormalizeDouble
or Market Info or something?
S/L T/P CloseP. Prof/Loss
BUY 1.29400 0.78589 0.00000 1.29414 .98

Here is my 5 Digit code and down below one from the code base.
That one is done under the Start Function instead of the Initialization?
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

if (Digits == 5 || Digits == 3) // Adjust for five (5) digit brokers.
{
pips2dbl = Point*10;
}
else
{
pips2dbl = Point;
}

TrailingStop = pips2dbl*trailingStop;
Slippage = pips2dbl*slippage;
}

Taken from code base:

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

int digits=MarketInfo("EURUSD",MODE_DIGITS);
if(digits==5){int StopMultd=10;} else{StopMultd=1;}
int Slippage=Slip*StopMultd;

}

 
 
jimtrader1:

Thanks, I am going to print this information out and the Market Info. also. Yeah I have got the Bid and Ask backwards for the Trailing stop.
 
RaptorUK:

What errors ?

This will cause you issue in some circumstances . . .

. . . check return values after each function and report any errors before calling the next function.

Also, a Buy Order is placed at Ask, a Buy is closed with a Sell and that is executed at Bid . . . in your Modify you are setting your SL relative to Bid and your TP relative to Ask . . . . whichever way you slice and dice it you are going to have to pay the Spread and make sure your TP and SL fit in with the Freezelevel and Stoplevels . . . there is comprehensive info here that is worth spending some time with and getting a thorough understanding of: Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial


I have been reading the book links that you gave me and working on an updated EA. It doesn't contain my actual signal code. I kind of want to keep

it unexposed for now.This IS the base format for it though. I put in new 5 digit code and also MODE_STOPLEVEL that Dabbler said I should do. Don't think

I have it right. I keep getting error 130 with this updated version. Started with a 9 on the Trailing stop. I raised it to 15 which should be far

enough away from the market price. Still get a series of 130 errors. Note: This is with the EURUSD or dollar currencys. The EURJPY works fine on actual

trading in the demo acct. With the OLDER 5 Digit code that was in the earlier ECN_MACD that I attached.Places the trailing stop correctly and closes many

profitable trades. Must be we have a digit problem also then? The USDJPY may work but hasn't placed any trades yet.

Files:
 
jimtrader1:


I have been reading the book links that you gave me and working on an updated EA. It doesn't contain my actual signal code. I kind of want to keep

it unexposed for now.This IS the base format for it though. I put in new 5 digit code and also MODE_STOPLEVEL that Dabbler said I should do. Don't think

I have it right. I keep getting error 130 with this updated version. Started with a 9 on the Trailing stop. I raised it to 15 which should be far

enough away from the market price. Still get a series of 130 errors. Note: This is with the EURUSD or dollar currencys. The EURJPY works fine on actual

trading in the demo acct. With the OLDER 5 Digit code that was in the earlier ECN_MACD that I attached.Places the trailing stop correctly and closes many

profitable trades. Must be we have a digit problem also then? The USDJPY may work but hasn't placed any trades yet.


           res=OrderSend(Symbol(),OP_SELLLIMIT,LotsOptimized(),Bid,Slippage,0,0,"",MAGICMA,0,Red);

So you trie to open a sellimit with bid price and you get 130 errors

Why are you doing this.....

How do you place a pending trade ???

 
deVries:
Slippage = pips2dbl*slippage;
Look at my post again. I define two variables, pips2dbl and pips2points. The unit of slippage is points, slippage is an int. Therefor pips2dbl*slippage is zero. I gave you an example, but you didn't bother to read it.