
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hello,
One of my brokers does not deal lots anymore, only deals with quantities. So, if I want to deal what used to be 0.1 lots, now I have to enter 10,000.
What changes do I need to make to my EA's to make this happem?
For instance, see the example EA attached here ,which deals lots, can you show me the changes I need to make to the lots calculations, order entry and order modifications pieces?
Other wise I keep on getting ERROR 130 and 131, which I know are related to entering worng amount to be dealt and SL.
Many thanks in advance.
*************************************************
int start()
{
double total,Cena,cnt,lot;
double cenaoppos,l,sl;
total=OrdersTotal();
if(total<1)
{
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,0,1)>iStochastic(NULL, 0, per_K,per_D,slow,MODE_LWMA,1,1,1)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA, 1, 1,1)<zoneBUY)
{
sl=MaxLots*TrailingStop*Point+20*Point;
OrderSend(Symbol(),OP_BUY,Lots, Ask, 3,Bid-sl, Ask+TakeProfit*Point, 0,Green);
}
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,0,1)<iStochastic(NULL, 0, per_K,per_D,slow,MODE_LWMA,1,1,1)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA, 1, 1,1)>zoneSELL)
{
sl=MaxLots*TrailingStop*Point+20*Point;
OrderSend(Symbol(),OP_SELL,Lots, Bid, 3,Ask+sl, Bid-TakeProfit*Point, 0, Red);
}
}
if(total>0 && total<MaxLots)
{
for(cnt=0;cnt<total;cnt++)
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
cenaoppos=OrderOpenPrice();
lot=OrderLots()*2;
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
Cena=Ask;
if((cenaoppos-pips*Point)>Cena)
{
OrderSend(Symbol(), OP_BUY, lot, Ask, 3,0, Ask+TakeProfit*Point, 0, Green);
return(0);
}
}
else
{
Cena=Bid;
if((cenaoppos+pips*Point)<Cena)
{
OrderSend(Symbol(), OP_SELL, lot, Bid, 3,0, Bid-TakeProfit*Point, "macd sample", 16384,0,Red);
return(0);
}
}
}
}
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY)
{
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(), OrderOpenPrice(), Bid-Point*TrailingStop, Ask+TakeProfit*Point, 0,Green);
return(0);
}
}
}
}
else
{
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(), OrderOpenPrice(), Ask+Point*TrailingStop, Bid-TakeProfit*Point, 0,Red);
return(0);
}
}
}
}
//----------------------------------
}}