[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 578

 

Hello.

Question, is it possible to call a standard indicator in a custom indicator, but for a standard indicator to be calculated based on another custom indicator instead of the price?

Thank you.

 
What is in the standard code is the basis on which it will be calculated. In other words, you can't.
 
<br / translate="no"> What is in the standard code is the basis on which it will be calculated. In other words, you can't.

Unless, of course, it is "OnArray".
 
valenok2003 >>:
Что в коде стандартного заложено, на основе того он и будет расчитываться. Т.е. нельзя.
but you can use an algorithm identical to the standard indicator...
 
SergNF >>:

Если конечно не "OnArray"
What does it look like in the code?
 
trader_fx писал(а) >>
What does it look like in the code?


You fill an array and then put a "standard indicator" on it (RSIOnArray, CCIOnArray etc. - about 7 pieces).

Latest mention on the forum , and in general F1, tutorial etc.

 
guys who can explain Pyxlik2009 wrote >>

Все слава богу написал но вот сталкнулся с такой проблемой тестится тестится а потом тупо встанет и стоит в чем проблема?

I need a bit more speed to test the system, but my EA is not tested for a long time )))


 
Pyxlik2009 >>:
парни кто обьяснит Pyxlik2009 писал(а) >>

Все слава богу написал но вот сталкнулся с такой проблемой тестится тестится а потом тупо встанет и стоит в чем проблема?

и можно как нибудь увеличить скорость тестирования а то у меня не один так советник долго не тестится )))


If you optimize on a large timeframe - H4 or D1, using the method of all ticks and on a long timeframe, it happens. It is necessary to optimize the code, remove all unnecessary loops, reduce the size of buffers, arrays (where it is not necessary). Better yet, write the Expert Advisor for the opening prices. Make sure there is enough free memory left. In the past there were very strange bugs, for example, abundant use of comments like [/* ... */] slowed down testing, and after they were removed the testing started to run.

 

Here's the code for a newbie, please.

//+------------------------------------------------------------------+
//|                                          Arrows and Curves EA.mq4 |
//|           Простой эксперт использующий индикатор Стрелки и Линии |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006"
#property link      "kolas@list.ru"

// Параметры торговли для H4 EURUSD
extern double TrailingStop = 30;
extern double TakeProfit   = 30;
extern double StopLoss     = 80;

// Параметры  моего индикатора индикатора 
extern int MA_Period=13;
extern int MA_Shift=0;
extern int MA_Method=0;
extern int SSP             = 6; 

// Параметры MM
extern double Slippage     = 3;
extern bool PropotinalLots = false; // Реинвестирование
extern double MinDepo      = 100;   // Минимальный депозит
extern double FixedLots    = 0.1;   // Фиксированный размер ордера
extern double PercentLots  = 10;    // Процент реинвестирования

// Идентификация эксперта
extern string NameEA       = "Arrows and Curves";
extern int MAGICNUM        = 123;

double Lots;
double Sloss, Tprof;
bool Buy = false, Sell = false;
static int PrevBar = 0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() 
  {return(0);}
  
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() 
  {return(0);}
  
//+------------------------------------------------------------------+
//|  Получение сигналов на покупку и продажу                         |
//+------------------------------------------------------------------+
void Indicators() 
   {                  
      Buy = (iCustom(Symbol(),0,"BBANDS~1", MA_Period, MA_Shift, MA_Method,  2, 2) > 0) &&  (Time[0] != PrevBar);
      Sell = (iCustom(Symbol(),0,"BBANDS~1", Length, Deviation, MoneyRisk, Signal, Line, Nbars, 3, 3) > 0) && (Time[0] != PrevBar);
   }
   
//+------------------------------------------------------------------+
//|  Вывод предупреждения об отправке ордера                         |
//+------------------------------------------------------------------+
void prtAlert(string str = "") 
  {
      Print(str);
      Alert(str);
  }
  
//+------------------------------------------------------------------+
//|  Расчет размера ордера                                           |
//+------------------------------------------------------------------+
void LotsSize()
   {
      Lots = FixedLots;
      if (PropotinalLots) Lots = MathCeil(AccountFreeMargin() / 10000 * PercentLots) / 10;
      if (Lots > 10000) Lots = 10000;
   }  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() 
  {
   // Проверка истории
   if(Bars < SSP) 
     {
       Print("Not enough bars for this strategy - ", NameEA);
       return(-1);
     }
   // Расчет значений индикатора
   Indicators();
   
   // Расчет желаемого размера ордера
   LotsSize();   

   // Трейлинг и разворот
   int totalOrders = OrdersTotal();
   int numPos = 0;

   for(int i = 0; i < totalOrders; i++) 
     {
       OrderSelect(i, SELECT_BY_POS);    
       if(OrderSymbol() == Symbol() && OrderMagicNumber() == MAGICNUM) 
         {
           numPos++;
           // Проверяем покупку
           if(OrderType() == OP_BUY) 
             {
               // Закрываем при развороте
               if (Sell) 
               {
                  OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Blue); 
                  numPos--;
               }
               else
               // Трейлинг стоп
               if(TrailingStop > 0) 
                 {
                   if(Bid - OrderOpenPrice() > TrailingStop*Point) 
                     {
                       if(OrderStopLoss() < (Bid - TrailingStop*Point))
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Bid - TrailingStop*Point, OrderTakeProfit(), 0, Blue);
                     }
                 }
               
             } 
           else 
             // Проверяем продажу
             {
               // Закрываем при развороте
               if (Buy) 
               {
                  OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
                  numPos--;
               }
               else
               // Трейлинг стоп
               if(TrailingStop > 0) 
                 {
                   if(OrderOpenPrice() - Ask > TrailingStop*Point)
                     {
                       if(OrderStopLoss() == 0 || OrderStopLoss() > Ask + TrailingStop*Point)
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Ask + TrailingStop*Point, OrderTakeProfit(), 0, Red);
                     }           
                 }
             }
         }
     }
     
   // Открываем новые ордера
   if(numPos < 1)
     {   
       // Если размер депозита устраивает
       if(AccountFreeMargin() < MinDepo)
         {
           Print("Not enough money to trade ", Lots, " lots. Strategy:", NameEA);
           return(0);
         }
       // Если есть сигнал на покупку
       if (Buy)
         {
           Sloss = Ask - StopLoss * Point;
           Tprof = Bid + TakeProfit * Point;
           PrevBar = Time[0];
            OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, Sloss, Tprof, NameEA + CurTime(), 
                     MAGICNUM, 0, Green);
           prtAlert("Buying"); 
         }
       // Если есть сигнал на продажу
       if (Sell) 
         {
           Sloss = Bid + StopLoss * Point;
           Tprof = Ask - TakeProfit * Point;
           PrevBar = Time[0];
            OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, Sloss, Tprof, NameEA + CurTime(), 
                     MAGICNUM, 0, Red);
           prtAlert("Selling"); 
         }
     } 

   return(0);
  }
 
Pyxlik2009 >>:

вот код подскажите новичку плиз.

everyone's figured out why it's taking so long ))))