Говно
Советника к ниму напиши....
Выдает ложные сигналы
Yevgeniy Vyal'tsev:
Советника к ниму напиши....
Вот!!! - можно и другой Индикатор, похожего на этот
//+------------------------------------------------------------------+ //| Stalin Sample.mq4 | //| Copyright 2005-2014, MetaQuotes Software Corp. | //| http://www.mql4.com | //+------------------------------------------------------------------+ #property copyright "2005-2014, MetaQuotes Software Corp." #property link "http://www.mql4.com" //--- Inputs input double Lots = 0.1; // Lot input double MaximumRisk = 0.02; // MaximumRisk input double DecreaseFactor = 3; // DecreaseFactor input double TakeProfit = 500; // Take Profit input double TrailingStop = 300; // Trailing Stop input string short_name = "Stalin"; // Name Indicators input bool InpOnlyOne = false; // Close opposite input bool ObjRevers = false; // Revers //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CheckForClose(void) { double MacdCurrent,SignalCurrent; int cnt,total; //--- if(Bars<100) { Print("bars less than 100"); return; } if(TakeProfit<10) { Print("TakeProfit less than 10"); return; } //--- to simplify the coding and speed up access data are put into internal variables MacdCurrent=iCustom(NULL,0,short_name,MODE_MAIN,1); SignalCurrent=iCustom(NULL,0,short_name,MODE_SIGNAL,1); total=OrdersTotal(); if(total<1) { //--- no opened orders identified if(AccountFreeMargin()<(1000*LotsOptimized())) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; } } //--- it is important to enter the market correctly, but it is more important to exit it correctly... for(cnt=0; cnt<total; cnt++) { if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderType()<=OP_SELL && // check for opened position OrderSymbol()==Symbol()) // check for symbol { //--- long position is opened if(OrderType()==OP_BUY) { if(!InpOnlyOne) { //--- should it be closed? if((ObjRevers && MacdCurrent<SignalCurrent) || (!ObjRevers && MacdCurrent>SignalCurrent)) { //--- close order and exit if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet)) Print("OrderClose error ",GetLastError()); return; } } //--- check for trailing stop if(TrailingStop>0) { if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss()<Bid-Point*TrailingStop) { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green)) Print("OrderModify error ",GetLastError()); return; } } } } else // go to short position { if(!InpOnlyOne) { //--- should it be closed? if((ObjRevers && MacdCurrent>SignalCurrent) || (!ObjRevers && MacdCurrent<SignalCurrent)) { //--- close order and exit if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet)) Print("OrderClose error ",GetLastError()); return; } } //--- check for trailing stop if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red)) Print("OrderModify error ",GetLastError()); return; } } } } } } //--- } //+------------------------------------------------------------------+ //| Calculate open positions | //+------------------------------------------------------------------+ int CalculateCurrentOrders(string symbol) { int buys=0,sells=0; //--- for(int i=-1; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()==Symbol() && OrderMagicNumber()==16384) { if(OrderType()==OP_BUY) buys++; if(OrderType()==OP_SELL) sells++; } } //--- return orders volume if(buys>0) return(buys); else return(-sells); } //+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { double lot=Lots; int orders=HistoryTotal(); // history orders total int losses=0; // number of losses orders without a break //--- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //--- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1; i>=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //--- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1); } //--- return lot size if(lot<0.1) lot=0.1; return(lot); } //+------------------------------------------------------------------+ //| Check for open order conditions | //+------------------------------------------------------------------+ void CheckForOpen() { double MacdCurrent,SignalCurrent; int res; //--- go trading only for first tiks of new bar if(Volume[0]>1) return; //--- get Moving Average MacdCurrent=iCustom(NULL,0,short_name,MODE_MAIN,1); SignalCurrent=iCustom(NULL,0,short_name,MODE_SIGNAL,1); //--- sell conditions if((ObjRevers && MacdCurrent<SignalCurrent) || (!ObjRevers && MacdCurrent>SignalCurrent)) { res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,Bid-TakeProfit*Point,"",16384,0,Red); return; } //--- buy conditions if((ObjRevers && MacdCurrent>SignalCurrent) || (!ObjRevers && MacdCurrent<SignalCurrent)) { res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,Ask+TakeProfit*Point,"",16384,0,Green); return; } //--- } //+------------------------------------------------------------------+ //| OnTick function | //+------------------------------------------------------------------+ void OnTick() { //--- check for history and trading if(Bars<100 || IsTradeAllowed()==false) return; //--- calculate open orders by current symbol if(CalculateCurrentOrders(Symbol())==0) CheckForOpen(); CheckForClose(); //--- } //+------------------------------------------------------------------+
Igor Yeremenko:
чем он отличается от MACD?
чем он отличается от MACD?
этот вопрос - ко мне ? Если ко мне - Эксперт работает от сигнала этого Индикатора или можно похожего Индикатора вписать
input string short_name = "Stalin"; // Name Indicators

Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
STALIN:
Author: Andrey Vassiliev