Simple and yet Complicated to Find Error_130

 

Hi everyone, (PLEASE HELP ME if u manage to figure out, thanks)

i have been backtesting a simple program but i did not encounter any problem.

Suprisingly, things go weird when i use the same program & running on a forward demo test which i keep on encounter "Error occured 130"

i realised that these error comes from OrderSend() command and i have trial & error all value and command with the SL & TP in OrderSend() but all end up with error 130

The only set of value that did not have any error 130 is value SL=0, TP=0

i really dunno what happen, all i need to do is just to set stop loss and the direction which SL & TP being put using bid and ask price is also correct in my opinion

i have been using ODL MT4 and FXCM MT4 demo account to forward test and it comes with the same error 130 as well..

Below is the attached print screen of the error, the EA and part of the source code:

//Trading criteria


Opn_B=true; // Criterion for opening Buy


// Opening orders

while(true) // Orders closing loop

{

if (Total==0 && Opn_B==true) // No new orders +

{ // criterion for opening Buy

RefreshRates(); // Refresh rates

SL=Bid - New_Stop(StopLoss)*Point; // Calculating SL of opened

TP=Bid + New_Stop(TakeProfit)*Point; // Calculating TP of opened

Alert("Attempt to open Buy. Waiting for response..");

Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP);//Opening Buy

if (Ticket > 0) // Success :)

{

Alert ("Opened order Buy ",Ticket);

return; // Exit start()

}

if (Fun_Error(GetLastError())==1) // Processing errors

continue; // Retrying

return; // Exit start()

}

break; // Exit while

}

Files:
 

u should send the order withot a TP & SL & then use OrderModify() to set the TP & SL

 
qjol:

u should send the order withot a TP & SL & then use OrderModify() to set the TP & SL


Hi qjol,

Does this really makes a huge different? i will definitely try though..

But i just wonder why we cant send the order with TP or SL..thanks for c

 
Ashleyter:


Hi qjol,

Does this really makes a huge different? i will definitely try though..

But i just wonder why we cant send the order with TP or SL..thanks for c


yes, this really makes a huge different
 
qjol:

yes, this really makes a huge different

Alright!! Will try it immediately and see the result..Thanks again bro..
 

It depends on company. Some allow to open with TP and SL, some want you to open and then modify.

It should all be written in agreement docs that you are supposed to read when register, I believe.

 

Mostly those who call themselves ECN brokers.


If you open the manual order form (for manually opening a trade) and the fields for SL and TP are grayed out then you know that this broker is running this modded MT4 version, then you won't be able to open a trade with SL and TP. Unfortunately they forgot to apply the same modifications to the strategy tester.

 
7bit:

Mostly those who call themselves ECN brokers.


If you open the manual order form (for manually opening a trade) and the fields for SL and TP are grayed out then you know that this broker is running this modded MT4 version, then you won't be able to open a trade with SL and TP. Unfortunately they forgot to apply the same modifications to the strategy tester.



What I find odd about this is that while you can't set TP or SL values for a market order (instant execute) you can set the SL and TP values in any of the pending order types (stops and limits) and those TP and SL values do in fact carry over into the trade's position after the pending order is triggered and converted into a market order by the system.

 
 

Hi,

Please try this:

"Ticket=OrderSend(Symb,OP_BUY,Lts,NormalizeDouble(Ask,Digits),2,NormalizeDouble(SL,Digits),NormalizeDouble(TP,Digits));//Opening Buy"

Best regards