Strategy based on the "ZigZag" indicator - "Last ZZ50" - page 3

 

Last ZZ50.mq5 version "1.001"

I decided first to check how the indicator behaves when a new bar appears or after a break in communication: on every tick I get the amount of calculated data for our indicator, if this amount differs from the amount on the previous tick - a print is displayed:

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   static int  bars_calculated      = 0;
   int         prev_bars_calculated = bars_calculated;
   bars_calculated=BarsCalculated(handle_iCustom);
   if(bars_calculated!=prev_bars_calculated)
      Print(iTime(0),", BarsCalculated: ",bars_calculated,", prev: ",prev_bars_calculated);
//---

  }

And now two logs (Experts tab and Journal tab)

Experts:

2017.07.17 08:03:32.161 Last ZZ50 (USDJPY,M1)   2017.07.17 08:03:00, BarsCalculated: 373610, prev: 100009
2017.07.17 08:04:05.250 Last ZZ50 (USDJPY,M1)   2017.07.17 08:04:00, BarsCalculated: 373611, prev: 373610
2017.07.17 08:05:45.575 Last ZZ50 (USDJPY,M1)   2017.07.17 08:05:00, BarsCalculated: 100000, prev: 373611
2017.07.17 08:06:08.768 Last ZZ50 (USDJPY,M1)   2017.07.17 08:06:00, BarsCalculated: 100001, prev: 100000
2017.07.17 08:07:06.192 Last ZZ50 (USDJPY,M1)   2017.07.17 08:07:00, BarsCalculated: 100002, prev: 100001
2017.07.17 08:07:29.676 Last ZZ50 (USDJPY,M1)   2017.07.17 08:07:00, BarsCalculated: 100002, prev: 0
2017.07.17 08:08:01.653 Last ZZ50 (USDJPY,M1)   2017.07.17 08:08:00, BarsCalculated: 100003, prev: 100002
2017.07.17 08:09:01.827 Last ZZ50 (USDJPY,M1)   2017.07.17 08:09:00, BarsCalculated: 100004, prev: 0
2017.07.17 08:10:00.283 Last ZZ50 (USDJPY,M1)   2017.07.17 08:10:00, BarsCalculated: 100005, prev: 100004
2017.07.17 08:11:02.493 Last ZZ50 (USDJPY,M1)   2017.07.17 08:11:00, BarsCalculated: 100006, prev: 100005

Log:

2017.07.17 08:04:47.227 Network '6121033': scanning network for access points
2017.07.17 08:05:23.297 Network '6121033': connection to MetaQuotes-Demo lost
2017.07.17 08:05:34.000 Network '6121033': authorized on MetaQuotes-Demo through Access Point EU 2 (ping: 48.01 ms)
2017.07.17 08:05:34.001 Network '6121033': previous successful authorization performed from 178.165.123.77 on 2017.07.17 07:50:17
2017.07.17 08:05:34.105 Network '6121033': terminal synchronized with MetaQuotes Software Corp.
2017.07.17 08:05:34.105 Network '6121033': trading has been enabled - hedging mode
2017.07.17 08:07:28.881 Experts expert Last ZZ50 (USDJPY,M1) removed
2017.07.17 08:07:28.915 Experts expert Last ZZ50 (USDJPY,M1) loaded successfully
2017.07.17 08:08:53.494 Experts expert Last ZZ50 (USDJPY,M1) removed
2017.07.17 08:08:53.527 Experts expert Last ZZ50 (USDJPY,M1) loaded successfully


As you can see the number of calculated bars changes.

Files:
Last_ZZ50.mq5  10 kb
 

Last ZZ50.mq5 version "1.002"

New: add indicator used in the calculations to the chart - for visualization (then it will look for "A", "B" and "C" points and draw a vertical line on them - again, for visual code control).


Files:
Last_ZZ50.mq5  11 kb
 

Last ZZ50.mq5 version "1.003"

Looks for vertices "A", "B" and "C". Draws vertical lines through these vertices.

Searching of vertices is performed by method "getting values from one bar at a time".

Last ZZ50 version "1.003"

Files:
Last_ZZ50.mq5  23 kb
 
Vladimir Karputov:

Last ZZ50.mq5 version "1.003"

Looks for vertices "A", "B" and "C". Draws vertical lines through these vertices.

The search of vertices is done by "getting a value from one bar at a time" method.


Already something)

 

Vladimir, will there be a sequel, or we'll call it a day =)

 
Vitaly Muzichenko:

Vladimir, will there be a sequel, or will we end it there =)


Tomorrow there will be a description - already with pending orders.

 

I have discovered four point formations "A", "B" and "C" - I need to figure out how to place pending orders in each case (or rather their type: Buy*** or Sell***):

Figure 1 and 2 иFigure 3 and 4


 
Vladimir Karputov:

I have found four point formations "A", "B" and "C" - I need to figure out how to place pending orders in each case (or rather their type: Buy*** or Sell***):

Put and drag always in the middle of the beam:

Runs:

Red SellStop, blue BuyStop

One order is placed on one ray. If an order has worked on this ray, do not place more orders on it

 
Vitaly Muzichenko:

Always put and haul in the middle of the beam:

Exhausted:

Red SellStop, blue BuyStop.

On one ray, there is one order and if the order worked on this ray, do not place more orders on it


The "worked out" is not always the case, because the EA may appear on the chart at any moment. Therefore, I ask you once again to review Fig. 3 and Fig. 4 in terms of: The EA has just entered the chart and there is such a picture...

 
Vladimir Karputov:

"Worked out" is not always the case, as the EA can get up on the chart at any time. Therefore, please once again review Fig. 3 and Fig. 4 in terms of: the Expert Advisor has just moved to the chart and there is a picture...

If the centre of the ray is broken, the ray is considered worked out

To avoid problems after the restart, the points of the latest ray should be saved in the global variable of the terminal, and work with them.

Reason: