Исходный код · ID 3688
ma_v_1_3_3.mq4
Похожие материалы по тегам
ea robofibo source v.11.2.mq4MetaTrader 4 · 1 общих теговsma crossover scalper ea for mt4.mq4MetaTrader 4 · 1 общих теговr15 pivot points expert advisor by @fundedmillionairess.mq4MetaTrader 4 · 1 общих теговnewstrader.mq5MetaTrader 5 · 1 общих теговmm3.0_flip_codepro_v3.1_with_cooldown@lifeindreamsworld.mq5MetaTrader 5 · 1 общих теговmm3.0_flip_codepro_v3.1_with_cooldown.mq5MetaTrader 5 · 1 общих тегов
Вы автор или правообладатель?
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «ma_v_1_3_3.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
Поиск по коду файла
/*------------------------------------------------------------------------------------------------------------------------------- specification ---//
enum ENUM_TF { current=0,M1=1,M5=5,M15=15,M30=30,H1=60,H4=240,D1=1440,W1=10080,MN1=43200 };
extern string _0_="___ ????? ?????? ___";
extern int TradeMode=1;
extern string _1_="___ ????????? Fast MA ___";
extern int Period_=13,
Shift_=0;
extern ENUM_MA_METHOD Method_MA_=MODE_SMA;
extern ENUM_APPLIED_PRICE Apply_to_=PRICE_CLOSE;
extern string _2_="___ ????????? Slow MA ___";
extern int Period__=21,
Shift__=0;
extern ENUM_MA_METHOD Method_MA__=MODE_SMA;
extern ENUM_APPLIED_PRICE Apply_to__=PRICE_CLOSE;
extern string _3_="___ ????????? ??? ___",
_3_1_="___ true - ??????????, false - ?? ??????? ___";
extern bool LotConst_or_not=true;
extern double Lot=0.1,
RiskPercent=1.0;
extern string _3_2_="___ ?????????? ???? ___";
extern double FirstLotMultiplicator=1.65;
extern double First_LotSize=1.0;
extern double First_LotSize_TakeProfit=650.0;
extern double First_MaxLotSize=2.5;
extern string _4_="___ ????????? ?????????? ????? Fast MA ? Slow MA ___";
extern bool Use_Distance=false;
extern double Distance=100.0;
extern string _5_="___ ??????? ? ??????? - TP ___";
extern bool Use_TakeProfit=true;
extern double TakeProfit=500.0;
extern string _6_="___ ?????? ?????????? ___";
extern int Varyant=1;
extern string _7_="___ ???? ? ??????? - SL ___";
extern bool Use_StopLoss=true;
extern double StopLoss=250.0;
extern string _8_="___ ?????????? ????? ???????? (Step Up) ___";
extern bool Use_Step_Up=true;
extern double Step_Up=100.0;
extern string _8_1_="___ Trailing stop ___";
extern bool Use_TrailingStop=true;
extern double TrailingStop=250.0;
extern string _9_="___ ?????????? ????? ???????? (Step Down) ___";
extern bool Use_Step_Down=true;
extern double Step_Down=150.0;
extern string _10_="___ ????????????? ??????? ????????? ___";
extern int Magic=135;
extern string _11_="___ ??????? ? ????? ?????? (true - ???????? ??? false - ?????????) ___";
extern bool ShowTableOnTesting=false;
extern string _12_="___ ??????? ????-????? ????????, ???? current - ????-????? ???????? ??????? ___";
extern ENUM_TF Tf=current;
extern string _13_="___ Trade time ___";
extern bool Use_trade_time=false;
extern string Open_trade="08:00:00";
extern string Close_trade="21:30:00";
extern string _14_="___ Turn ___";
extern bool Use_Turn=true;
extern double Turn=250.0;
extern double LotMultiplicator=1.65;
extern double Turn_TakeProfit=500.0;
extern double Turn_LotSize=1.0;
extern double Turn_LotSize_TakeProfit=650.0;
extern double Turn_MaxLotSize=2.5;
double TickSize,TickValue,Spread,StopLevel,MinLot,MaxLot,LotStep,Pnt,
TP;
int order_type,T,
sumBO,sumSO,sumBS,sumSS,sumBL,sumSL,sumO,sumS,sumL,_sumBO,_sumSO,_sumBS,_sumSS,_sumBL,_sumSL,_sumO,_sumS,_sumL,
NumbUp,NumbDn,Numb,
PrevFirstTicket;
bool Ans,_Ans,Activate,FatalError,FreeMarginAlert,IsTester,IsVisual;
int init()
{
// код доступен только после оплаты
}
int deinit()
{
Comment("");
if(!IsTester)
{
if(IsVisual && ShowTableOnTesting) Obj_Del();
switch(UninitializeReason())
{
case 0: if(Use_Turn) GVD("Numb"); else { GVD("NumbUp"); GVD("NumbDn"); GVD("PrevFirstTicket"); } break;
case 1: if(Use_Turn) GVD("Numb"); else { GVD("NumbUp"); GVD("NumbDn"); GVD("PrevFirstTicket"); } break;
} // switch
}
return(0);
}
int start()
{
// код доступен только после оплаты
}
void Trade()
{
double ma_fast=ma(Period_,Shift_,Method_MA_,Apply_to_,0),ma_slow=ma(Period__,Shift__,Method_MA__,Apply_to__,0),lot=0.0;
if(sumBO==0 && (TradeMode==1 || (TradeMode==2 && sumSO==0)) &&
ma_fast>ma_slow && (!Use_Distance || (Use_Distance && ND(ma_fast-ma_slow)>Distance*Pnt)))
{
if(!TradeTime()) return;
lot=_GetLot();
if(First_MaxLotSize>0.0 && NL(lot)>=First_MaxLotSize) lot=GetLot();
if(First_LotSize>0.0 && NL(lot)>=First_LotSize) TP=First_LotSize_TakeProfit; else TP=TakeProfit;
if(sumSO>0 && !ClosePos(OP_SELL)) return;
if(MO(OP_BUY,lot,GetComment())==-1) return;
if(!ModifyByTicket(T)) return;
NumbUp=0; NumbDn=0; PrevFirstTicket=T;
}
else
if(sumSO==0 && (TradeMode==1 || (TradeMode==2 && sumBO==0)) &&
ma_fast<ma_slow && (!Use_Distance || (Use_Distance && ND(ma_slow-ma_fast)>Distance*Pnt)))
{
if(!TradeTime()) return;
lot=_GetLot();
if(First_MaxLotSize>0.0 && NL(lot)>=First_MaxLotSize) lot=GetLot();
if(First_LotSize>0.0 && NL(lot)>=First_LotSize) TP=First_LotSize_TakeProfit; else TP=TakeProfit;
if(sumBO>0 && !ClosePos(OP_BUY)) return;
if(MO(OP_SELL,lot,GetComment())==-1) return;
if(!ModifyByTicket(T)) return;
NumbUp=0; NumbDn=0; PrevFirstTicket=T;
}
else
if(sumBO>0)
{
lot=GetOrdDouble("lot",PrevFirstTicket);
if(First_LotSize>0.0 && NL(lot)>=First_LotSize) TP=First_LotSize_TakeProfit; else TP=TakeProfit;
if(Use_Step_Up && ND(Ask-ExtrLevOrd("BuyMax"))>=Step_Up*Pnt)
{
if(MO(OP_BUY,GetLot(),GetComment(NumbUp+1))==-1) return;
if(!ModifyByTicket(T)) return;
NumbUp++;
}
else
if(Use_Step_Down && ND(ExtrLevOrd("BuyMin")-Ask)>=Step_Down*Pnt)
{
if(MO(OP_BUY,GetLot(),GetComment(NumbDn-1))==-1) return;
if(Use_StopLoss) { if(!ModifyByTicket(T)) return; }
if(Use_TakeProfit) { if(!Modify_TP(Get_TP(TP,OP_BUY),OP_BUY)) return; }
NumbDn--;
}
}
else
if(sumSO>0)
{
lot=GetOrdDouble("lot",PrevFirstTicket);
if(First_LotSize>0.0 && NL(lot)>=First_LotSize) TP=First_LotSize_TakeProfit; else TP=TakeProfit;
if(Use_Step_Up && ND(ExtrLevOrd("SellMin")-Bid)>=Step_Up*Pnt)
{
if(MO(OP_SELL,GetLot(),GetComment(NumbUp+1))==-1) return;
if(!ModifyByTicket(T)) return;
NumbUp++;
}
else
if(Use_Step_Down && ND(Bid-ExtrLevOrd("SellMax"))>=Step_Down*Pnt)
{
if(MO(OP_SELL,GetLot(),GetComment(NumbDn-1))==-1) return;
if(Use_StopLoss) { if(!ModifyByTicket(T)) return; }
if(Use_TakeProfit) { if(!Modify_TP(Get_TP(TP,OP_SELL),OP_SELL)) return; }
NumbDn--;
}
}
}
void Trade2()
{
double lot=0.0,tp=0.0,lev_inst=0.0,ma_fast=ma(Period_,Shift_,Method_MA_,Apply_to_,0),ma_slow=ma(Period__,Shift__,Method_MA__,Apply_to__,0);
if(sumO==0 && ma_fast>ma_slow && (!Use_Distance || (Use_Distance && ND(ma_fast-ma_slow)>Distance*Pnt)))
{
if(sumS>0 && !DelOrd()) return;
if(!TradeTime()) return;
if(sumSO>0 && !ClosePos(OP_SELL)) return;
if(MO(OP_BUY,GetLot(),GetComment())==-1) return;
if(!ModifyByTicket(T)) { Numb=1; return; }
lev_inst=GetOrdDouble("sl",T);
lot=GetOrdDouble("lot",T);
if(Turn_MaxLotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_MaxLotSize) { Numb=1; return; }
if(Turn_LotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_LotSize) tp=Turn_LotSize_TakeProfit; else tp=Turn_TakeProfit;
if(PO(OP_SELLSTOP,lev_inst,lev_inst+Turn*Pnt,lev_inst-tp*Pnt,LotMultiplicator*lot,GetComment(1))==-1) { Numb=1; return; }
Numb=1;
}
else
if(sumO==0 && ma_fast<ma_slow && (!Use_Distance || (Use_Distance && ND(ma_slow-ma_fast)>Distance*Pnt)))
{
if(sumS>0 && !DelOrd()) return;
if(!TradeTime()) return;
if(sumBO>0 && !ClosePos(OP_BUY)) return;
if(MO(OP_SELL,GetLot(),GetComment())==-1) return;
if(!ModifyByTicket(T)) { Numb=1; return; }
lev_inst=GetOrdDouble("sl",T);
lot=GetOrdDouble("lot",T);
if(Turn_MaxLotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_MaxLotSize) { Numb=1; return; }
if(Turn_LotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_LotSize) tp=Turn_LotSize_TakeProfit; else tp=Turn_TakeProfit;
if(PO(OP_BUYSTOP,lev_inst,lev_inst-Turn*Pnt,lev_inst+tp*Pnt,LotMultiplicator*lot,GetComment(1))==-1) { Numb=1; return; }
Numb=1;
}
else
if(sumBO>0 && sumSS==0)
{
T=GetTicket("market","last","trade"); if(T==-1) return;
lev_inst=GetOrdDouble("sl",T);
lot=GetOrdDouble("lot",T);
if(lev_inst==0.0)
{
if(!ModifyByTicket(T)) return;
lev_inst=GetOrdDouble("sl",T);
}
if(Turn_MaxLotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_MaxLotSize) return;
if(Turn_LotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_LotSize) tp=Turn_LotSize_TakeProfit; else tp=Turn_TakeProfit;
if(PO(OP_SELLSTOP,lev_inst,lev_inst+Turn*Pnt,lev_inst-tp*Pnt,LotMultiplicator*lot,GetComment(Numb+1))==-1) return;
Numb++;
}
else
if(sumSO>0 && sumBS==0)
{
T=GetTicket("market","last","trade"); if(T==-1) return;
lev_inst=GetOrdDouble("sl",T);
lot=GetOrdDouble("lot",T);
if(lev_inst==0.0)
{
if(!ModifyByTicket(T)) return;
lev_inst=GetOrdDouble("sl",T);
}
if(Turn_MaxLotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_MaxLotSize) return;
if(Turn_LotSize>0.0 && NL(LotMultiplicator*lot)>=Turn_LotSize) tp=Turn_LotSize_TakeProfit; else tp=Turn_TakeProfit;
if(PO(OP_BUYSTOP,lev_inst,lev_inst-Turn*Pnt,lev_inst+tp*Pnt,LotMultiplicator*lot,GetComment(Numb+1))==-1) return;
Numb++;
}
else
if(sumO==0 && sumS>0)
{
if(!DelOrd()) return;
}
}
int GetTicket(string type="",string position="last",string list="trade")
{
int pos=0,i=0,ticket=0,ticket_prev=-1;
if(list=="trade")
{
for(pos=OrdersTotal()-1; pos>=0; pos--)
{
if(!OrderSelect(pos,SELECT_BY_POS,MODE_TRADES) || OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic) continue;
if((type=="" && OrderType()>5) || (type=="market" && OrderType()>1) || (type=="buy" && OrderType()!=0) || (type=="sell" && OrderType()!=1)) continue;
ticket=OrderTicket();
if((position=="first" && (ticket_prev==-1 || ticket_prev>ticket)) || (position=="last" && (ticket_prev==-1 || ticket_prev<ticket)))
ticket_prev=ticket;
}
/*for*/
}
else
if(list=="history")
{
for(pos=OrdersHistoryTotal()-1; pos>=0; pos--)
{
if(!OrderSelect(pos,SELECT_BY_POS,MODE_HISTORY) || OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic) continue;
if((type=="" && OrderType()>5) || (type=="market" && OrderType()>1) || (type=="buy" && OrderType()!=0) || (type=="sell" && OrderType()!=1)) continue;
ticket=OrderTicket();
if((position=="first" && (ticket_prev==-1 || ticket_prev>ticket)) || (position=="last" && (ticket_prev==-1 || ticket_prev<ticket)))
ticket_prev=ticket;
i++; if(i==100) break;
}
/*for*/
}
return(ticket_prev);
}
double GetOrdDouble(string value,int ticket)
{
if(!OrderSelect(ticket,SELECT_BY_TICKET)) return(0.0);
if(value=="op") return(OrderOpenPrice()); else
if(value=="lot") return(OrderLots()); else
if(value=="sl") return(OrderStopLoss()); else
if(value=="tp") return(OrderTakeProfit()); else
if(value=="cp") return(OrderClosePrice()); else
if(value=="result") return(OrderProfit()); else
if(value=="swap") return(OrderSwap()); else
if(value=="commission") return(OrderCommission());
return(0.0);
}
int GetOrdInt(string value,int ticket)
{
if(!OrderSelect(ticket,SELECT_BY_TICKET)) return(-1);
if(value=="type") return(OrderType()); else
if(value=="id") return(OrderMagicNumber()); else
if(value=="ot") return(OrderOpenTime()); else
if(value=="ct") return(OrderCloseTime());
return(-1);
}
void Trail()
{
if(Use_Turn || !Use_TrailingStop || sumO==0) return;
double op,tp,sl,sl_lev;
int i;
for(int pos=OrdersTotal()-1; pos>=0; pos--)
{
if(!OrderSelect(pos,SELECT_BY_POS,MODE_TRADES) || OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic || OrderType()>1) continue;
op=OrderOpenPrice(); sl=OrderStopLoss(); tp=OrderTakeProfit();
Ans=false;
if(OrderType()==OP_BUY)
{
if(ND(Bid-op)<=TrailingStop*Pnt) continue;
if(sl!=0.0 && ND(Bid-sl)<=TrailingStop*Pnt) continue;
sl_lev=Bid-TrailingStop*Pnt;
if(ND(Bid-sl_lev)<StopLevel) continue;
}
else if(OrderType()==OP_SELL)
{
if(ND(op-Ask)<=TrailingStop*Pnt) continue;
if(sl!=0.0 && ND(sl-Ask)<=TrailingStop*Pnt) continue;
sl_lev=Ask+TrailingStop*Pnt;
if(ND(sl_lev-Ask)<StopLevel) continue;
}
i=0;
while(!Ans && i<5)
{
Ans=OrderModify(OrderTicket(),ND(op),ND(sl_lev),ND(tp),NULL,clrYellow);
if(!Ans) { if(!Errors(GetLastError())) break; } i++;
}
/*while*/
}
/*for*/
}
bool TradeTime()
{
if(!Use_trade_time) return(true);
datetime time_now=TimeCurrent(),time_start,time_end;
int sec=86400,day=DayOfWeek();
if(StПоказано первые 50% кода (символов: 22605)
Что вы получите после оплаты
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? Адрес передаётся вместе с заказом в магазин и сохраняется для связи заказа с оплатой. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.
Стоимость полного кода: 2 261 ₽ (≈ $26.68 USDT)