У нынешнего Израиля по сути нет возможности не ответить. Сегодня ожидается совещание руководства страны, где будет принято решение по ответному удару. Учитывая влияние США, возможно, что его тоже сделают ограниченным, сославшись на то, что Израиль сбил почти все дроны и ракеты за пределами страны, а потому атака Ирана как бы и не в счет.
функция шага не работает
<code>//*************************************************************// for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { op=NormalizeDouble(OrderOpenPrice(),Digits()); tp=NormalizeDouble(OrderTakeProfit(),Digits()); lt=NormalizeDouble(OrderLots(),2); tk=OrderTicket(); if(OrderType()==OP_BUY) { if(b>=1 && tp==0) if(!OrderModify(tk,op,OrderStopLoss(),NormalizeDouble(Ask+TakeProfit*Point(),Digits()),0,clrNONE)) Print("OrderModify error #",GetLastError()); if(b>=3) { if(tk==BuyPriceMaxTic || tk==BuyPriceMinTic) if(Bid<AwerageBuyPrice && tp!=AwerageBuyPrice) if(!OrderModify(tk,op,OrderStopLoss(),AwerageBuyPrice,0,clrNONE)) Print("OrderModify error #",GetLastError()); if(tk!=BuyPriceMaxTic && tk!=BuyPriceMinTic && tp!=0) if(!OrderModify(tk,op,0,0,0,clrNONE)) Print("OrderModify error #",GetLastError()); } if(Revers && Bid<=op-slv) if(OrderSend(Symbol(),OP_SELL,lt,NormalizeDouble(Bid,Digits()),Slippage,0,0," ",MagicNumber,0,clrRed)<0) Print("OrderSend error #",GetLastError()); } //--- if(OrderType()==OP_SELL) { if(s>=1 && tp==0) if(!OrderModify(tk,op,OrderStopLoss(),NormalizeDouble(Bid-TakeProfit*Point(),Digits()),0,clrNONE)) Print("OrderModify error #",GetLastError()); if(s>=3) { if(tk==SelPriceMaxTic || tk==SelPriceMinTic) if(Ask>AwerageSelPrice && tp!=AwerageSelPrice) if(!OrderModify(tk,op,OrderStopLoss(),AwerageSelPrice,0,clrNONE)) Print("OrderModify error #",GetLastError()); if(tk!=SelPriceMaxTic && tk!=SelPriceMinTic && tp!=0) if(!OrderModify(tk,op,0,0,0,clrNONE)) Print("OrderModify error #",GetLastError()); if(Revers>0 && Ask>=op+slv) if(OrderSend(Symbol(),OP_BUY,lt,NormalizeDouble(Ask,Digits()),Slippage,0,0," ",MagicNumber,0,clrBlue)<0) Print("OrderSend error #",GetLastError()); } } } /* //--- double Prof = GetProfit(); if((LevelStopLoss>0 && Prof<=-LevelStopLoss) || (LevelStopProfit>0 && Prof>=LevelStopProfit)) ClosePlus(); //--- if(LevelStopLoss<0 && Prof<=LevelStopLoss) CloseMinus(); if(LevelStopProfit<0 && Prof>=-LevelStopProfit) ClosePlus(); */ } //************************************************************************************************/ bool CheckVolumeValue(double volume) { //--- минимально допустимый объем для торговых операций double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN); if(volume<min_volume) return(false); //--- максимально допустимый объем для торговых операций double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX); if(volume>max_volume) return(false); //--- получим минимальную градацию объема double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP); int ratio=(int)MathRound(volume/volume_step); if(MathAbs(ratio*volume_step-volume)>0.0000001) return(false); return(true); } //************************************************************************************************/ /*СИГНАЛ*/ //------------------------------------------------------------------ int Signal() // Создаем функцию получения сигнала на указанном ТФ и баре { double current_openprice = iOpen (Symbol(),TF , iB); double Mashka =iMA(NULL,0,Per_MA,0,0,4,iB) ; double Atrium=0; Atrium = 0.2 * iATR(NULL,TF_ATR,Per_MA,iB); if(Bid>=current_openprice) { SellBuff = (58000000.0 * (Bid - Mashka) * Atrium); BuyBuff = (58000000.0 * (Low[iB] - Mashka) * Atrium); } if(Bid<current_openprice) { SellBuff = (58000000.0 * (High[iB] - Mashka) * Atrium); BuyBuff = (58000000.0 * (Bid - Mashka) * Atrium); } if (SellBuff > LevelSell) return OP_SELL; if (BuyBuff < -LevelBuy) return OP_BUY; return -1; // Иначе нет сигнала. Возвращаем в int Signai () -1 (никаких сигналов) } //************************************************************************************************ double GetProfit() { double Profit=0; for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) Profit += OrderProfit() + OrderCommission() + OrderSwap(); return (Profit); } //************************************************************************************************ bool CloseAll() { for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) if(!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage)) { Sleep(500); i=i+1;//?????????????? } if(OrderType()==OP_SELL) if(!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage)) { Sleep(500); i=i+1;//?????????????? } } return true; } //************************************************************************************************ bool ClosePlus() { for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol() && OrderProfit()>0) { if(OrderType()==OP_BUY) if(!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage)) { Sleep(500); i=i+1;//?????????????? } if(OrderType()==OP_SELL) if(!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage)) { Sleep(500); i=i+1;//?????????????? } } return true; } //************************************************************************************************ bool CloseMinus() { for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol() && OrderProfit()<=0) { if(OrderType()==OP_BUY) if(!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage)) { Sleep(500); i=i+1;//?????????????? } if(OrderType()==OP_SELL) if(!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage)) { Sleep(500); i=i+1;//?????????????? } } return true; } //************************************************************************************************ </code>
<code>#property strict //--- enum ENUM_Metod { Shaman = 0, ShamanSmart = 1, Normal = 2 }; input ENUM_Metod Metod = Shaman; // Metod - тип работы советника, метод открытия ордеров. input bool Agressor = true; // Agressor - функция влияет только на расчет ордеров. input bool Revers = false; // Вместо SL создает полный замок. input int CloseLim = 5; // Close Limit - функция оставляет к-во ордеров в каждом направлении. //--- // input double LevelStopLoss = 0; // input double LevelStopProfit = 0; //--- input double StartLots = 0.05; // Start lot input double CoeffLots = 1.7; input double MaximalLots = 2.56; // Maximal Lot input int StopLoss = 352; // Stop Loss (in pips) input int TakeProfit = 737; // Take Profit (in pips) input int PointOrderStep = 33; // Point order step (in pips) input int MinimalProfit = 35; // Minimal profit for close Average orders (in pips) //--- input ENUM_TIMEFRAMES TF = PERIOD_H1; // Тайм Фрейм для расчета входа input ENUM_TIMEFRAMES TF_ATR = PERIOD_H1; // Тайм Фрейм для ATR input int Per_MA = 14; input int LevelSell = 22; input int LevelBuy = 62; //--- input int MagicNumber = 1961; // Magic Number input int Slippage = 30; // Slippage //--- double SellBuff; double BuyBuff; double ShortSig; double LongSig; double op,lt,tp,slv; int tk,b,s; int iB=1; double BuyPriceMax=0,BuyPriceMin=0,BuyPriceMaxLot=0,BuyPriceMinLot=0, SelPriceMin=0,SelPriceMax=0,SelPriceMinLot=0,SelPriceMaxLot=0; double FullBU,BuyBU,SelBU; //************************************************************************************************/ int OnInit() { slv = StopLoss*Point; Comment(""); return(INIT_SUCCEEDED); } //************************************************************************************************/ void OnTick() { BuyPriceMax=0;BuyPriceMin=0;BuyPriceMaxLot=0;BuyPriceMinLot=0; SelPriceMin=0;SelPriceMax=0;SelPriceMinLot=0;SelPriceMaxLot=0; int BuyPriceMaxTic=0,BuyPriceMinTic=0,SelPriceMaxTic=0,SelPriceMinTic=0; double BuyLotsSum=0,SelLotsSum=0,WeighBuy=0, WeighSell=0; op=0;lt=0;tp=0; FullBU=0; tk=0;b=0;s=0; for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { op=NormalizeDouble(OrderOpenPrice(),Digits()); lt=NormalizeDouble(OrderLots(),2); tk=OrderTicket(); if(OrderType()==OP_BUY) { b++; BuyLotsSum += lt; WeighBuy += lt*op; if(op>BuyPriceMax || BuyPriceMax==0) { BuyPriceMax = op; BuyPriceMaxLot = lt; BuyPriceMaxTic = tk; } if(op<BuyPriceMin || BuyPriceMin==0) { BuyPriceMin = op; BuyPriceMinLot = lt; BuyPriceMinTic = tk; } } // === if(OrderType()==OP_SELL) { s++; SelLotsSum += lt; WeighSell += lt*op; if(op>SelPriceMax || SelPriceMax==0) { SelPriceMax = op; SelPriceMaxLot = lt; SelPriceMaxTic = tk; } if(op<SelPriceMin || SelPriceMin==0) { SelPriceMin = op; SelPriceMinLot = lt; SelPriceMinTic = tk; } } } //--- if(b>CloseLim && CloseLim!=0) if(OrderClose (BuyPriceMaxTic, BuyPriceMaxLot, Bid , Slippage, clrBlue)) return; if(s>CloseLim && CloseLim!=0) if(OrderClose (SelPriceMinTic, SelPriceMinLot, Ask , Slippage, clrRed)) return; //--- if(Metod!=Normal) if ((BuyLotsSum - SelLotsSum) != 0) FullBU = (WeighBuy - WeighSell)/(BuyLotsSum - SelLotsSum); //*************************************************************// double AwerageBuyPrice=0,AwerageSelPrice=0; if(b>=3) AwerageBuyPrice=NormalizeDouble ((BuyPriceMax*BuyPriceMaxLot+BuyPriceMin*BuyPriceMinLot)/(BuyPriceMaxLot+BuyPriceMinLot)+MinimalProfit*Point(),Digits()); if(s>=3) AwerageSelPrice=NormalizeDouble ((SelPriceMax*SelPriceMaxLot+SelPriceMin*SelPriceMinLot)/(SelPriceMaxLot+SelPriceMinLot)-MinimalProfit*Point(),Digits()); //*************************************************************// double BuyLot=0,SelLot=0; if(Agressor && (Metod==Normal || Metod==Shaman)) { if(BuyPriceMinLot==0) BuyLot=StartLots; else BuyLot=MathCeil(BuyPriceMinLot * 100 * CoeffLots)/100; if(SelPriceMaxLot==0) SelLot=StartLots; else SelLot=MathCeil(SelPriceMaxLot * 100 * CoeffLots)/100; } if(!Agressor && (Metod==Normal || Metod==Shaman)) { if(BuyPriceMinLot==0) SelLot=StartLots; else SelLot=MathCeil(BuyPriceMinLot * 100 * CoeffLots)/100; if(SelPriceMaxLot==0) BuyLot=StartLots; else BuyLot=MathCeil(SelPriceMaxLot * 100 * CoeffLots)/100; } if(Metod==ShamanSmart) { if(SelPriceMaxLot==0) BuyLot=StartLots; else BuyLot=SelLotsSum*2; if(BuyPriceMinLot==0) SelLot=StartLots; else SelLot=BuyLotsSum*2; } //*************************************************************// if(BuyLot>MaximalLots) BuyLot=MaximalLots; if(SelLot>MaximalLots) SelLot=MaximalLots; if(!CheckVolumeValue(BuyLot) || !CheckVolumeValue(SelLot)) return; //*************************************************************// if(Metod==Normal) { if(Signal()==OP_BUY) if((b==0) || (b>0 && Ask<=BuyPriceMin-PointOrderStep*Point())) if(OrderSend(Symbol(),OP_BUY,NormalizeDouble(BuyLot,2),NormalizeDouble(Ask,Digits()),Slippage,0,0," ",MagicNumber,0,clrBlue)<0) Print("OrderSend error #",GetLastError()); if(Signal()==OP_SELL) if((s==0) || (s>0 && Bid>=SelPriceMax+PointOrderStep*Point())) if(OrderSend(Symbol(),OP_SELL,NormalizeDouble(SelLot,2),NormalizeDouble(Bid,Digits()),Slippage,0,0," ",MagicNumber,0,clrRed)<0) Print("OrderSend error #",GetLastError()); } //--- if(Metod==Shaman || Metod==ShamanSmart) { if(Signal()==OP_BUY && Ask<FullBU) if((b==0) || (b>0 && Ask<=BuyPriceMin-PointOrderStep*Point())) if(OrderSend(Symbol(),OP_BUY,NormalizeDouble(BuyLot,2),NormalizeDouble(Ask,Digits()),Slippage,0,0," ",MagicNumber,0,clrBlue)<0) Print("OrderSend error #",GetLastError()); if(Signal()==OP_SELL && Bid>FullBU) if((s==0) || (s>0 && Bid>=SelPriceMax+PointOrderStep*Point())) if(OrderSend(Symbol(),OP_SELL,NormalizeDouble(SelLot,2),NormalizeDouble(Bid,Digits()),Slippage,0,0," ",MagicNumber,0,clrRed)<0) Print("OrderSend error #",GetLastError()); } </code>
njdftgh