Opening, closing in Expert Advisor generated by MQL5 Wizard - page 6

 
Andy:

EURUSD on M1; not ticks, but by bars; test from 18:00 MSK; (cannot insert screenshot).


Please read carefully, point by point:

tick generation mode, test dates: from ... To. Screenshot of the line name from the tester and at the same time log entries. In general a detailed description.


 
Andy:

Everything is written except the screenshot (take my word for it).


Read the above. Until you have written EVERYTHING, I will not reply.

 
Andy:

Why did they delete my post?

EURUSD on M1; not ticks but by bars; test from 18:00 MSC.

Here, bearish candle at 18:15is on the long line and short in the log.



Updated the file (now prints the "0" pattern too).


Added: use Strategy Tester - no need to torture the terminal live at once :)

Files:
 
Andy:

Wasn't there one, and which ones were there?


Open the file: CSignalMA::LongCondition and CSignalMA::ShortCondition functions - you can see all the prints there. And now I have to take my leave, it's time for the stove.

 
Andy:

On the lines it writes correctly (long) but in the log it says short (pattern 1).


Please provide the following information:

  1. trading account type: netting or hedge
  2. screenshot from the Strategy Tester: "Settings" and "Parameters" tab
  3. Describe in detail what you mean by "The lines are correct (long), but the log is short (pattern 1)".

 
Andy:
For netting and hedge accounts the default settings are correct (no need to make a screenshot), but when the patch 1 is to be executed, the line writes everything correctly (long), but in fact the log of the Expert Advisor is short and vice versa. You can check it yourself - run the file and it will be the same in the terminal and in the tester. And then how do you remove these lines?

When the position is reversed - at that moment two vertical lines are created - you can check this: the last two lines will have the same time. To visualise - I replaced the vertical line with objects "OBJ_ARROW_UP" and "OBJ_ARROW_DOWN":

Step 1

и

Step 2

As you can see in the second screenshot you can see that there were TWO signals and a buy signal was won (Sell position was closed and a buy position was opened).

When generating an EA, look for the module called "Signals of indicator 'Moving Average' + OBJ_ARROW_UP_DOWN".


 
Andy:

And for pattern 1 there should be a Sell signal as the candle is bullish, but the indicator is falling (weak rebound from the indicator line).

These two signals are from which pattern, one is from 1 (Sell) and the other is from where (Buy)?


I will now think about what else to put in the logs to see the inner workings of both the signals module and the CExrert class.

 
Andy:

And on pattern 1 there should be a Sell signal as the candle is bullish, but the indicator is falling (weak rebound from the indicator line).

These two signals are from which pattern, one is from 1 (Sell) and the other is from where (Buy)?


Vladimir Karputov:

I will now think about what else to put in the logs to show the inner workings of both the signals module and CExrert class.


Signal module version 1.001 - now outputs (prints) signal direction, pattern number, signal strength and formulas

   double            DiffMA(int ind)                     { return(MA(ind)-MA(ind+1));  }
   double            DiffOpenMA(int ind)                 { return(Open(ind)-MA(ind));  }
   double            DiffHighMA(int ind)                 { return(High(ind)-MA(ind));  }
   double            DiffLowMA(int ind)                  { return(Low(ind)-MA(ind));   }
   double            DiffCloseMA(int ind)                { return(Close(ind)-MA(ind)); }

Example output:

2017.01.13 00:00:18   ShortCondition: m_pattern_0 12247, result 80, Open(1.06259), Close(1.06229), MA(1.06475)
***
2017.01.13 17:00:00   LongCondition: m_pattern_0 26715, result 80, Open(1.06451), Close(1.06449), MA(1.06302)
2017.01.13 17:00:00   LongCondition: m_pattern_3 5648, result 60, Low(1.06199)-MA(1.06302)<0.0
 
Andy:
I will now try a new file, but on the previous one - with a bearish candle crossing a rising indicator, two signals: a sell from pattern 0 and a buy from 1, and it was a sell trigger.

Such a question is not accepted. Give a detailed description: screenshot from STRATEGY TESTER: "settings" tab, "parameters" tab. Date when you found the discrepancy: extract from TESTER log file, screenshot of the moment from visual testing.


Without providing these necessary data, further discussion is useless, as I or someone else MUST be able to unequivocally REVIEW your situation.

 
Andy:

And why two patterns are triggered at once (even in your screenshot)?


Because this is life and nobody cancelled the theory of probability (on very small timeframes, like M1, bar prices and indicator values are very close to each other - so situations when several patterns are detected simultaneously are possible). Run the Strategy Tester on H1 - then the situations will be more unambiguous.