Discussion of article "A Quick Start Or a Short Guide for Beginners"

 

New article A Quick Start Or a Short Guide for Beginners is published:

Hello dear reader! In this article, I will try to explain and show you how you can easily and quickly get the hang of the principles of creating Expert Advisors, working with indicators, etc. It is beginner-oriented and will not feature any difficult or abstruse examples.

A Quick Start Or a Short Guide for Beginners

Author: Дмитрий

 

Dimitri, you said you weren't a writer! But you are! Congratulations on a pleasant start. It's nice to realise that you started with a small material, even if it is not so voluminous, the main thing is to start, and there as it goes will be longer and longer to gain experience through your articles and / or from other writers.

Thank you for your attention.

 
GKS:

Dimitri, you said you weren't a writer! But you are! Congratulations on a pleasant start. It's nice to realise that you started with a small material, even if it is not so voluminous, the main thing is to start, and there as it goes will be longer and longer to gain experience through your articles and / or from other writers.

Thank you for your time.

Thank you. I didn't expect this from myself. I'll keep trying.
 
liked the clear presentation, I would like to continue in the same style e.g. about libraries....
 
iMA_handle=iMA("EURUSD",PERIOD_H1,40,0,MODE_SMA,PRICE_CLOSE);  //connect the indicator and get its handle
.......
   ChartIndicatorAdd(ChartID(),0,iMA_handle);     // add the indicator to the price chart
   
It doesn't work like that. But if you remove the symbol and the time, everything is OK.
iMA_handle=iMA(NULL,0,40,0,MODE_SMA,PRICE_CLOSE);
 
mln141:

It doesn't work like that. But if you remove the symbol and time, everything is OK.

If you test on EURUSD and hour timeframe, everything will work.

On the other hand, you have found the problem and solved it yourself using the help (maybe), what is not a plus?

Thank you, the article has been corrected.

 

some small questions:

1  what happen or rehappen  when time-period of chart changed during runing?

2  ima_handle defined at OnInit(),  iMA_handle=iMA("EURUSD",PERIOD_H1,10,0,MODE_SMA,PRICE_CLOSE);

 is it possible to change this handle's parameters dynamic by programself like change PERIOD_H1,10 to PERIOD_M15, 39 during runing?

3 what is deal? 

 

Congratulations!

Extremelly simple, well-written code... I think by doing reference to the library, you did in few lines what I did in almost 100 (only to open long and close long positions).

I refer specially to these lines:

 if(m_Position.Select(my_symbol))                     //if the position for this symbol already exists
        {
         if(m_Position.PositionType()==POSITION_TYPE_SELL) m_Trade.PositionClose(my_symbol);  //and this is a Sell position, then close it
         if(m_Position.PositionType()==POSITION_TYPE_BUY) return;                              //or else, if this is a Buy position, then exit
        }
      m_Trade.Buy(0.1,my_symbol);                          //if we got here, it means there is no position; then we open it
     }
   if(iMA_buf[1]<Close_buf[1] && iMA_buf[0]>Close_buf[0])  //if the indicator values were less than the closing price and became greater
     {
      if(m_Position.Select(my_symbol))                     //if the position for this symbol already exists
        {
         if(m_Position.PositionType()==POSITION_TYPE_BUY) m_Trade.PositionClose(my_symbol);   //and this is a Buy position, then close it
         if(m_Position.PositionType()==POSITION_TYPE_SELL) return;                             //or else, if this is a Sell position, then exit
        }
      m_Trade.Sell(0.1,my_symbol);                         //if we got here, it means there is no position; then we open it
     }
 

The only thing I missed may be a command to trade only when a new bar appears. There was a discussion in: www.mql5.com/en/forum/5762 

I use the following code, posted there by mogplus8:

static int   LastBarCount=0;

   if(Bars(_Symbol,_Period)>LastBarCount)
      LastBarCount=Bars(_Symbol,_Period);
   else
      return; 

 
Some images are flying, please fix them.
 

I am somewhat puzzled about your statement about Trades.

The trades presentted in the article is very close to "seals" in artiel http://mqlmagazine.com/leading-article/orders-positions-and-deals-part-i/. Are they the same thing ? what are their differences?

By the way, in the linked page, the author do states: Each order placed in the market is a trade itself, with its own result, independent of the others.  

I paste the words here just to clarify the possible misconceptions to those who paid attention to the comments.

thanks you.

Orders , positions and deals . Part I | MQLmagazine.com
  • mqlmagazine.com
This article is dedicated to working with orders, positions and deals. In this article we will discuss the general principles and passing to the new system. In a new article we will detail the MQL5 programming side on orders, positions and deals. MetaQuotes changed both the functions but also the principles in working with orders. A term...
 
Not a man but gold, great article. Out of a lot of materials, I, as a programming beginner, only yours))))))). Thank you for such an article, very simple language you wrote everything just awesome, now at least I understand what I do).