[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 288

 
TheXpert писал(а) >>

Tut. The expression you quoted is definitely worthwhile.

Thanks!

 
Good day to all). I have Grebenshchikov's trading system. It works in the channel and on the channel breakout and entry by pending orders out of a flat. I would like to test it on the history and update the MM with it. Maybe somebody has already implemented this system in the code? What elements may be used to build such a system? Here is the description of the system http://www.fx4u.ru/rinki-forex-commodities-cfd-futures-f14/strategii-opitnih-f4/ts-grebenschikova-si-forex-i-mi-t529.html
 

I have a question

you can make a period converter to display an average chart of the four major pairs ...

Considering that the dollar-yen has a price of, say, 101.50, translate it into the state of 1.0150, and then use it to build an average chart ...

And it would be nice to be able to use this medium chart in the test and optimization ...

thanks in advance for listening ...

 

Hello All and sundry!

Here is the code (only the start function)

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
    // Узнаем уровень стопов и спрэд
    int Spread = MarketInfo(Symbol(), MODE_SPREAD);
    int StopLevel = MarketInfo(Symbol(), MODE_STOPLEVEL);

    // Рассчитываем значения средних на 0-ом и 1-ом барах
    double MAF_0 = iMA(NULL, 0, MAFP, 0, 1, 1, 0);
    double MAF_1 = iMA(NULL, 0, MAFP, 0, 1, 1, 1);
    double MAS_0 = iMA(NULL, 0, MASP, 0, 1, 1, 0);
    double MAS_1 = iMA(NULL, 0, MASP, 0, 1, 1, 1);
    
   // ----открытие позиции Buy покупка-----
    if( MAF_0 > MAF_1 && MAS_0 > MAS_1) { //-условие на покупку--- 
    if( isCloseLastPosByTake( NULL, OP_SELL, MagicNumber) ==true) {
     if( CheckOrders(OP_SELL))                                      {
       if( StopLoss <= StopLevel+ Spread)
         double SL = 0;        else         SL = Ask - StopLoss*Point;
       if( TakeProfit <= StopLevel- Spread)
         double TP = 0;        else         TP = Ask + TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 5, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
                }
               }
              }
   //-------------------Конец блока покупки ------------------
    
  //  ----- Открытие позиции Sell продажа------------  
    if( MAF_0 < MAF_1 && MAS_0 < MAS_1) { //-условие на продажу---
    if( CheckOrders(OP_BUY))                                     {
      if( StopLoss <= StopLevel+ Spread)
         SL = 0;        else         SL = Bid + StopLoss*Point;
       if( TakeProfit <= StopLevel- Spread)
         TP = 0;        else         TP = Bid - TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 5, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
                 }
                }
   //-------------------конец блока продажи -------------------
     
   return(0);
  }//+----------КОНЕЦ ФУНКЦИИ СТАРТ -------------------+

//ЖЖЖЖЖЖЖ Другие вызываемые пользовательские функции ЖЖЖЖЖЖ
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.05.2008                                                     |
//|  Описание : Возвращает флаг закрытия                                       |
//|  последней позиции по тейку.                                               |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
bool isCloseLastPosByTake(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   ocp, otp;
  int      dg, i, j=-1, k=OrdersHistoryTotal();

  if ( sy=="0") sy=Symbol();
  for ( i=0; i< k; i++) {
    if (OrderSelect( i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()== sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if ( op<0 || OrderType()== op) {
            if ( mn<0 || OrderMagicNumber()== mn) {
              if ( t<OrderCloseTime()) {
                t=OrderCloseTime();
                j= i;
              }} }}}}}

  if (OrderSelect( j, SELECT_BY_POS, MODE_HISTORY)) {
    dg=MarketInfo( sy, MODE_DIGITS);
    if ( dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
    ocp=NormalizeDouble(OrderClosePrice(), dg);
    otp=NormalizeDouble(OrderTakeProfit(), dg);
    if ( ocp== otp) return( True);
  }
  return( False);
}
 

Here, one condition is sort of implemented, as recommended by rid. With his comments and corrections.

The Expert Advisor itself compiles, trades.......It's not true.......

I tried to put only long-n one trade in the tester, put only short-n one trade too.

The logic is simple, when the buy condition is fulfilled, the EA makes a deal, the deal is closed at take profit.

And then advisor waits WHEN THE NEXT TRADE CONDITION comes. ONLY THIS CONDITION SHOULD BE OPPOSITE TO THE PREVIOUS ONE.

Т. I.e. if the trade was on BAY, the next one should be on SHELL.

 

Also. In this thread, only much earlier, a question similar to mine was raised. It was about flags. That's why all this fuss is going on.

 

Another question.

Open 2 windows, 1st 5 minutes, 2nd 15 minutes.

Draw MAKs on both (10). IS IT RIGHT if on the 5-minute chart we draw a MA with (30), it corresponds to an MA with (10) on the 15-minute chart.

For charts of 15 and 30 the coefficient will be 2.

For charts of 30 and 1 hour the coefficient is 2.

For charts of 1h and 4h the coefficient will be 4.

Is this true or not????????????

 

igrok2008 писал(а) >>

Is this true or not????????????

Strictly speaking, no. But very close to it.

 

Hello.

This is my first time writing on the forum. Hopefully not the last. I'm a novice compared to what they write on the forum. I learnt the language a month or so about half a year ago from Sergei Korolev's "Textbook on Programming in MQL4".

I studied it a month or so about half a year ago with "Textbook on programming in MQL4" by Sergei Kovalev. I have already written several Expert Advisors and have been using them since then. I wrote a few Expert Advisors, custom indicators,

...custom indicators, scripts. I have always tried to find answers to all question that I do not understand on the forum. I have, however, been struggling with a seemingly minor detail and cannot find the answers.

Please help me.

The question is about the use of #include <XXX.mqh>, I have read the whole forum did not find an answer. On one of the threads it says:

"...I can also add that the eX4 file is self-sufficient - for it to work,
does not require include the source code of custom functions.
You can copy the ex4 file, send it to other traders and use it there.
It is complete regardless of the technology to get it."

This is the problem. When passing the EA it does not "see" the function, but writes when compiling - cannot open the program file .

Although in include on the other terminal an uncompiled entry appeared in ex4.

Can you explain the error. Thanks.

 
gvi2504 >> :

... When passing the EA, it does not "see" the function, but writes when compiling - cannot open the program file .

Although in include on the other terminal an entry appeared which is not compiled in ex4.

Can you explain the error. Thank you.

Please give me an example, with full logs. How the library is called in the EA, what's in the title of the library itself. Maybe that's it.

By the way, TheXpert was running around here somewhere, he's good at this stuff.

Reason: