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: Дмитрий

 

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; 

 

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...
 

I am a begginer and I think that this kind of articles is very interesting. Thanks

 

it helped me a lot for the beginnings. Thanks again

 
Thank you very much for the helpful article.
Reason: