#property version "1.1"
input double Risk=3; // ????????? ???
input int TP=2200;
input int SL=0;
input int Fast=30;
input int Slow=500;
input int Sign=36;
double Money,Deposit=5000;
int MACD;
void OnInit()
{
// код доступен только после оплаты
}
void OnTick()
{
// код доступен только после оплаты
}
bool TradeSignalCounter(bool &UpSignal,bool &DnSignal)
{
if(Bars(_Symbol,0)<100) return(false);
static int Recount;
if(IsNewBar() || Recount)
{
double Ind[2],Sig[3];
DnSignal=false;
UpSignal=false;
Recount=false;
if(CopyBuffer(MACD,0,1,2,Ind)<0) Recount=true;
if(CopyBuffer(MACD,1,1,3,Sig)<0) Recount=true;
if(Recount==true) return(false);
if(Ind[0]>0 && Ind[1]<0) DnSignal=true;
if(Ind[0]<0 && Ind[1]>0) UpSignal=true;
if(Ind[1]<0 && Sig[0]<Sig[1] && Sig[1]>Sig[2]) DnSignal=true;
if(Ind[1]>0 && Sig[0]>Sig[1] && Sig[1]<Sig[2]) UpSignal=true;
return(true);
}
return(false);
}
bool TradePerformer(bool &UpSignal,bool &DnSignal)
{
if(UpSignal)
{
if(PositionOpen(POSITION_TYPE_BUY)) UpSignal=false;
}
if(DnSignal)
{
if(PositionOpen(POSITION_TYPE_SELL)) DnSignal=false;
}
return(true);
}
double Money_M()
{
HistorySelect(0,TimeCurrent());
int total=HistoryDealsTotal();
double profit=0;
for(int i=0;i<total;i++)
{
ulong deal_ticket=HistoryDealGetTicket(i);
if(HistoryDealGetString(deal_ticket,DEAL_SYMBOL)!=_Symbol) continue;
if(HistoryDealGetInteger(deal_ticket,DEAL_TYPE)>1) continue;
profit+=HistoryDealGetDouble(deal_ticket,DEAL_PROFIT);
profit+=HistoryDealGetDouble(deal_ticket,DEAL_SWAP);
}
Money=Deposit+profit;
if(PositionSelect(_Symbol))
{
Money+=PositionGetDouble(POSITION_PROFIT);
Money+=PositionGetDouble(POSITION_SWAP);
}
double Min=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
double Limit=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_LIMIT);
double Lots=Risk*Money/Deposit;
Lots=MathMin(Limit,MathMax(Min,Lots));
return(Lots);
}
bool PositionOpen(ENUM_POSITION_TYPE Type)
{
MqlTradeRequest request;
MqlTradeResult result;
MqlTradeCheckResult check;
ZeroMemory(request);
double volume=Money_M(Показано первые 50% кода (символов: 3765)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.