
mam pytanie co robię źle w kodzie że wyskakuje mi błąd ???

int TakeProfit_L = 100; // Take Profit in points
int StopLoss_L = 80; // Stop Loss in points
int TakeProfit_S = 100; // Take Profit in points
int StopLoss_S = 80; // Stop Loss in points
int TradeTime_1 = 14; // Time to enter the market double
int t1=1;
int TS_Distance = 25; // --- SL podąża za ceną w odległości 15pipsów
int TS_ActivatedLevel = 10; // --- poziom od którego TS zaczyna działać. Standardowo zaczyna działać po przekroczeniu ceny
int TS_JumpingLevel = 10; // --- odległość którą cena musi przejść, aby SL został przesunięty z zachowaniem TS_Distance
extern double lot = 0.01; // Lot size
extern bool AutoLot=true;
int ticket,total,cnt;
bool cantrade=true;
double closeprice;
double tmp;
int LotSize()
// The function opens a short position with lot size=volume
{
}
int globPos()
// the function calculates big lot size
{
int v1=GlobalVariableGet("globalPosic");
GlobalVariableSet("globalPosic",v1+1);
return(0);
}
int OpenLong1(double volume=0.01)
// the function opens a long position with lot size=volume
{
int slippage=0;
string comment="(PMLong14)";
color arrow_color=Red;
int magic=0;
if (GlobalVariableGet("globalBalans")>AccountBalance()) volume=lot;
// if (GlobalVariableGet("globalBalans")>AccountBalance()) if (AutoLot) LotSize();
ticket=OrderSend(Symbol(),OP_BUY,volume,Ask,slippage,Ask-StopLoss_L*Point,
Ask+TakeProfit_L*Point,comment,magic,0,arrow_color);
GlobalVariableSet("globalBalans",AccountBalance());
globPos();
// if (GlobalVariableGet("globalPosic")>25)
// {
GlobalVariableSet("globalPosic",10);
if (AutoLot) LotSize();
// }
if(ticket>0)
{
if(OrderSelect(ticket,MODE_TRADES,SELECT_BY_TICKET))
{
return(0);
}
else
{
Print("OpenLong(),OrderSelect() - returned an error : ",GetLastError());
return(-1);
}
}
else
{
Print("Error opening Buy order : ",GetLastError());
return(-1);
}
}
int OpenShort1(double volume=0.01)
// The function opens a short position with lot size=volume
{
int slippage=0;
string comment="PMShort14";
color arrow_color=Red;
int magic=0;
if (GlobalVariableGet("globalBalans")>AccountBalance()) volume=lot;
ticket=OrderSend(Symbol(),OP_SELL,volume,Bid,slippage,Bid+StopLoss_S*Point,
Bid-TakeProfit_S*Point,comment,magic,0,arrow_color);
GlobalVariableSet("globalBalans",AccountBalance());
globPos();
// if (GlobalVariableGet("globalPosic")>25)
// {
GlobalVariableSet("globalPosic",10);
if (AutoLot) LotSize();
// }
if(ticket>0)
{
if(OrderSelect(ticket,MODE_TRADES,SELECT_BY_TICKET))
{
return(0);
}
else
{
Print("OpenShort(),OrderSelect() - returned an error : ",GetLastError());
return(-1);
}
}
else
{
Print("Error opening Sell order : ",GetLastError());
return(-1);
}
}
int init()
{
// control of a variable before using
if (AutoLot) LotSize();
if(!GlobalVariableCheck("globalBalans"))
GlobalVariableSet("globalBalans",AccountBalance());
if(!GlobalVariableCheck("globalPosic"))
GlobalVariableSet("globalPosic",10);
return(0);
}
int deinit()
{
return(0);
}
int start()
for(int (i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS, MODE_TRADES) && (OrderSymbol() == Symbol()))
{
if((OrderType() == OP_BUY) && (Bid > (OrderOpenPrice() + TS_ActivatedLevel*Point)) && (OrderStopLoss() < (Bid - TS_JumpingLevel*Point - TS_Distance*Point)))
{
OrderModify(OrderTicket(), OrderOpenPrice(), (Bid - TS_Distance*Point), OrderTakeProfit(), OrderExpiration(), Gold)
{
return(0);
}
}
if((OrderType() == OP_SELL) && (Ask < (OrderOpenPrice() - TS_ActivatedLevel*Point)) && (OrderStopLoss() > (Ask + TS_JumpingLevel*Point + TS_Distance*Point)))
{
OrderModify(OrderTicket(), OrderOpenPrice(), (Ask + TS_Distance*Point), OrderTakeProfit(), OrderExpiration(), Gold)
{
return(0);
}
}
}
}
{
if((TimeHour(TimeCurrent())>TradeTime_1)) cantrade=true;
// check if there are open orders ...
{
// ... if no open orders, go further
// check if it's time for trade
if((TimeHour(TimeCurrent())==TradeTime_1)&&(cantrade))
{
// ... if it is
if ((Open[t1]-Close[t1])<(High[t1]-Open[t1])) //if it is
if (Close[t1]<Open[t1])
{
//condition is fulfilled, enter a short position:
// check if there is free money for opening a short position
if(AccountFreeMarginCheck(Symbol(),OP_SELL,lot)<=0 || GetLastError()==134)
{
Print("Not enough money");
return(0);
}
OpenShort1(0.01);
cantrade=false; //prohibit repeated trade until the next bar
return(0);
}
if ((Close[t1]-Open[t1])<(Open[t1]-Low[t1])) //if the price increased by delta
if (Close[t1]>Open[t1])
{
// condition is fulfilled, enter a long position
// check if there is free money
if(AccountFreeMarginCheck(Symbol(),OP_BUY,lot)<=0 || GetLastError()==134)
{
Print("Not enough money");
return(0);
}
OpenLong1(0.01);
cantrade=false;
return(0);
}
}
}