Download MetaTrader 5

Requests & Ideas (MQL5 only!) - page 3

To add comments, please log in or register
Vladimir Karputov
Moderator
61292
Vladimir Karputov  
Till Monday. We're celebrating.
ITM7
57
ITM7  
Vladimir Karputov:


If satisfied, start with the trading conditions - look for the intersection ... (for starters will mark these places with the help of OBJ_ARROW icons)

Wingdings

Characters of Wingdings used with the OBJ_ARROW object:



Crossing of two iMA version   "1.002":


I remembered something that was not included in the input but is needed in the opening of pending orders, the Pending distance (in pips) needed to determine the breakout level to be used (if pending is activated). 

The breakout level should be (take profits amount + Pending distance), e.g if TP=40, Pending distance =10, then breakout level =(40+10)

I tried writing down the way the EA should function, it's just my basic understanding and perhaps some statements may not be making sense from the programming point of view, feel free to correct where necessary or where I am not clear. 

For easy referencing, i highlighted sell signal(1st MA crosses 2nd MA from the top)  with that colour and

                                                       buy signal(1st MA crosses 2nd MA from below)  with that colour 

This are the trading conditions  :

1. Check open positions and pending orders to modify/close them accordingly.

2. Check if time limit for daily trading is exceeded or not, if it's exceeded, stop here and don't trade (comment: Daily trading session exceeded). If it's not exceeded, continue to #3

3. Check if margin cut off level has been reached, if true, stop here and don't trade (comment: Margin cut off level reached). If it's not reached yet, continue to #4

4. Check if the number of open positions in the currency pair is more than 3, if it's more than 3, stop here, don't trade. If it's less than 3, continue to #5


5. BUY:   5.1 If filter is used, buy when (1st MA crosses 2nd MA from below) AND (1st MA is bigger than 3rd MA)  

If Pending is Activated, buy stop order should also be placed. (3 attempts should be made to a buy stop order, if it fails, report error at desktop by notification, email and push)

     5.2 If filter is not used, buy when (1st MA crosses 2nd MA from below) 

  If Pending is Activated, buy stop order should also be placed. 


6. SELL: 6.1 If filter is used, sell when (1st MA crosses 2nd MA from the top) AND (1st MA is less than 3rd MA)  

If Pending is Activated, sell stop order should also be placed. 

    6.2 If filter is not used, sell when (1st MA crosses 2nd MA from the top) 

  If Pending is Activated, sell stop order should also be placed. 

Very important: 3 attempts should be made to a buy/sell stop orders and to buy/sell at market, if it fails, report error at desktop by notification, email and push notification)


This is how 1. Check open positions and pending orders to modify/close them accordingly.  will be done

1. If Trailing stop is activated, modify trailing stops

2. Closing Buy/Sell positions:  If (Trailing stop AND Stop loss is zero)

Close Buy position if (1st MA crosses 2nd MA from the top)    - when a selling signal has occurred

        Close Sell position if (1st MA crosses 2nd MA from below)      - when a buying signal has occurred

3. Deleting Pending orders:    Delete Buy stop order if (1st MA crosses 2nd MA from the top)    - when a selling signal has occurred

                                               Delete Sell stop order if (1st MA crosses 2nd MA from below)      - when a buying signal has occurred



Wingdings

Characters of Wingdings used with the OBJ_ARROW object:

I don't seem to understand what you mean by that, kindly explain


Till Monday, enjoy your celebration and thank you for taking time into making this EA a success :-)  :-)


Vladimir Karputov
Moderator
61292
Vladimir Karputov  
ITM7:


I remembered something that was not included in the input but is needed in the opening of pending orders, the Pending distance (in pips) needed to determine the breakout level to be used (if pending is activated). 

The breakout level should be (take profits amount + Pending distance), e.g if TP=40, Pending distance =10, then breakout level =(40+10)

...


Understood nothing. Please show your thought in the picture. Especially show:

Vladimir Karputov
Moderator
61292
Vladimir Karputov  

The definition of "Pending distance" and the setting of the trade: a pending order or the market will be replaced by one setting - "Price level".

Example: MQL5 Wizard: How to Teach an EA to Open Pending Orders at Any Price ->

The value of Signal_PriceLevel is usually a quite big number. The difference between negative and positive values is shown below:

Signal_PriceLevel=-50:

Fig. 1. Signal_PriceLevel=-50

Fig. 1. Signal_PriceLevel=-50

Signal_PriceLevel=50:

Fig. 2. Signal_PriceLevel=50

Fig. 2. Signal_PriceLevel=50

Thus, if Signal_PriceLevel=-50, a pending order will be opened at the price that is less favorable than the current price, whereas if Signal_PriceLevel=50, a pending order will be opened at the price that is better than the current price.

Ali irwan
4939
Ali irwan  
I listen to it, becouse I now want to leran language programing MQL5.
Vladimir Karputov
Moderator
61292
Vladimir Karputov  
Ali irwan:
I listen to it, becouse I now want to leran language programing MQL5.

Welcome!
For studying of MQL5 begin with a simple task. Set the simple task - received a MQL5 code. It is the simplest way of training.
ITM7
57
ITM7  
Vladimir Karputov:

The definition of "Pending distance" and the setting of the trade: a pending order or the market will be replaced by one setting - "Price level".

Example: MQL5 Wizard: How to Teach an EA to Open Pending Orders at Any Price ->

The value of Signal_PriceLevel is usually a quite big number. The difference between negative and positive values is shown below:

Signal_PriceLevel=-50:


Fig. 1. Signal_PriceLevel=-50

Signal_PriceLevel=50:


Fig. 2. Signal_PriceLevel=50

Thus, if Signal_PriceLevel=-50, a pending order will be opened at the price that is less favorable than the current price, whereas if Signal_PriceLevel=50, a pending order will be opened at the price that is better than the current price.

Oh, now I see that I was not clear at all, my bad. 

I have attached a piture that explains how the Signal_PriceLevel will be determined when the user also specifies a " Pending Distance ", 

I tried putting the picture here where I am typing but it kept saying invalid file type, 

In the picture, Signal_PriceLevel = -6.2 (the value happened to be small but the logic is the same), I showed how the Siganl_PriceLevel should be determined by making use of Take profit and " Pending distance " values. 

I also noticed that what I referred to as Break Out Distance is actually what is called Signal_PriceLevel, 

Let me know if I am still not clear in the picture so that I can try another approach explaining how to determine the Signal_PriceLevel using TP and " Pending Distance ". 

ITM7
57
ITM7  
ITM7:

Oh, now I see that I was not clear at all, my bad. 

I have attached a piture that explains how the Signal_PriceLevel will be determined when the user also specifies a " Pending Distance ", 

I tried putting the picture here where I am typing but it kept saying invalid file type, 

In the picture, Signal_PriceLevel = -6.2 (the value happened to be small but the logic is the same), I showed how the Siganl_PriceLevel should be determined by making use of Take profit and " Pending distance " values. 

I also noticed that what I referred to as Break Out Distance is actually what is called Signal_PriceLevel, 

Let me know if I am still not clear in the picture so that I can try another approach explaining how to determine the Signal_PriceLevel using TP and " Pending Distance ". 


The Signal_PriceLevel can also be determined in this way: 

Signal_PriceLevel for a sell stop order = - [ (Market sell price - Take Profit - Pending distance) ] 

Signal_PriceLevel for a buy stop order = - [ (Take Profit + Pending distance) - Market buy price ] 

The EA will only make Pending stop orders and not limit orders.

Or is it not possible to set the Signal_PriceLevel in that way?

Vladimir Karputov
Moderator
61292
Vladimir Karputov  
ITM7:


The Signal_PriceLevel can also be determined in this way: 

Signal_PriceLevel for a sell stop order = - [ (Market sell price - Take Profit - Pending distance) ] 

Signal_PriceLevel for a buy stop order = - [ (Take Profit + Pending distance) - Market buy price ] 

The EA will only make Pending stop orders and not limit orders.

Or is it not possible to set the Signal_PriceLevel in that way?


About the "Pending distance" I understood. It turns out that a pending order is a top-up (increase) of a position?
Vladimir Karputov
Moderator
61292
Vladimir Karputov  
ITM7:

Crossing of two iMA version   "1.003".

So far such functions work:

  • lot is calculated as risk percent from balance
  • we find crossing and we open on the market (without the pending orders)

Files:
12345678910...28
To add comments, please log in or register