MQL4 - automated forex trading   /  

Forum

What's mean"Error opening BUY order : 133"?

Back to topics list To post a new topic, please log in or register

avatar
6
tiger3 2006.03.07 07:05 
11:38:21 try_1min EURUSD,M1: Error opening BUY order : 133
11:38:53 try_1min EURUSD,M1: Error opening SELL order : 133
11:40:07 try_1min EURUSD,M1: Error opening BUY order : 133
11:40:31 try_1min EURUSD,M1: Error opening BUY order : 133
11:43:40 try_1min EURUSD,M1: Error opening SELL order : 133
11:47:16 try_1min EURUSD,M1: Error opening BUY order : 133
11:47:20 try_1min EURUSD,M1: Error opening BUY order : 133
What's mean"Error opening BUY order : 133"? Thanks.
Enhancing the Quality of the Code with the Help of Unit Test

Enhancing the Quality of the Code with the Help of Unit Test

Even simple programs may often have errors that seem to be unbelievable. "How could I create that?" is our first thought when such an error is revealed. "How can I avoid that?" is the second question which comes to our mind less frequently. It is impossible to create absolutely faultless code, especially in big projects, but it is possible to use technologies for their timely detection. The article describes how the MQL4 code quality can be enhanced with the help of the popular Unit Testing method.


avatar
30
CockeyedCowboy 2006.03.07 07:20 
tiger3



ERR_TRADE_DISABLED 133 Trade is disabled.

avatar
6
tiger3 2006.03.07 15:22 
double TakeProfit = 80;
double TrailingStop = 50;
int ExtPeriod=8;
double ExtBuffer;
double preExtBuffer;
int Lots=1;
double level_low=23,level_high=77;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int cnt, ticket, total;
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // check TakeProfit
}
// to simplify the coding and speed up access
// data are put into internal variables

ExtBuffer=100+iWPR(NULL,0,ExtPeriod,0);
preExtBuffer=100+iWPR(NULL,0,ExtPeriod,1);

total=OrdersTotal();

if(total<1)
{
// no opened orders identified
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
// check for long position (BUY) possibility

if(preExtBuffer<level_low && ExtBuffer>=level_low) // buy condition
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-TrailingStop*Point,Ask+TakeProfit*Point, "macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
// check for short position (SELL) possibility
if(preExtBuffer<level_high && ExtBuffer>=level_high) // sell condition

{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Point*TrailingStop,Bid-TakeProfit*Point, "macd sample",16384,0,Aqua);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
// it is important to enter the market correctly,
// but it is more important to exit it correctly...
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
if(preExtBuffer<level_high && ExtBuffer>=level_high) //buy close
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Red); // close position
return(0); // exit
}
// check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(), 0,Yellow);
return(0);
}
}
}
}
else // go to short position
{
// should it be closed?
if(preExtBuffer>level_low && ExtBuffer<=level_low) //sell close
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Aqua); // close position
return(0); // exit
}
// check for trailing stop
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(), 0,Blue);
return(0);
}
}
}
}
}
}
return(0);
}
// the end. Please check for me. Thanks

avatar
6
tiger3 2006.03.08 18:11 
00:03:22 '303313': trading by experts is prohibited
00:03:22 '303313': trading by experts is prohibited
00:03:37 '303313': trading by experts is prohibited
00:03:37 '303313': trading by experts is prohibited
00:08:17 '303313': trading by experts is prohibited

avatar
Moderator
5198
stringo 2006.03.09 13:31 
tiger3, your broker forbid trading operations by expert advisor

avatar
6
tiger3 2006.03.13 08:53 
thanks
Back to topics list  

To add comments, please log in or register