fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. sidmcfarland
    3. Posts
    S
    • Profile
    • Following 1
    • Followers 0
    • Topics 1
    • Posts 6
    • Best 5
    • Controversial 0
    • Groups 0

    Posts made by sidmcfarland

    • RE: Indicator rounding and cross (x> and x<) logic

      Lesson learned. Steer clear of X> and X<
      ... at least until they work correctly. Use two blocks instead explicitly specifying <,>= or >,<= Thanks for the help @roar.

      posted in Bug Reports
      S
      sidmcfarland
    • RE: Indicator rounding and cross (x> and x<) logic

      You're getting more lines than me after making your changes to define the cross explicitly with two conditions (< on candle 1 and > on candle 2, and vice versa). However, you're still not getting them all (as you mentioned/circled). I think that's probably because you're using < and > instead of <= and >=. Just a guess.

      So I suppose I could replace my X> and X< conditions with two conditions...

      Instead of A (candle 1) X> B (candle 1), use A (candle 1) > B (candle 1) AND A (candle2) <= B (candle 2)
      Instead of A (candle 1) X< B (candle 1), use A (candle 1) < B (candle 1) AND A (candle2) >= B (candle 2)

      A little more complex, but it works (I got all the crosses now)...
      https://fxdreema.com/shared/aTk06CFM
      0_1602885657339_a5a771d5-26ae-40f1-857e-9d5e19e51c07-image.png

      Unfortunately, it defeats the purpose of X> and X<, and is a little more complex (requires two condition blocks instead of one).

      posted in Bug Reports
      S
      sidmcfarland
    • RE: Indicator rounding and cross (x> and x<) logic

      Here's a good example.
      https://fxdreema.com/shared/zL7SQMC4

      I ran that EA in strategy tester in MT5 on EURUSD 1-hour chart for the current month (Oct 1, 2020 to Oct 16, 2020). Here are the results.

      0_1602883315642_cd44a475-f2f2-47b7-bf4c-b21b06081e2b-image.png

      Notice how there are several crosses that have no lines.

      posted in Bug Reports
      S
      sidmcfarland
    • RE: Indicator rounding and cross (x> and x<) logic

      I do have an EA, but I'm not at liberty to share it. However, I did confirm the issue is due to rounding of the EMA value. I added a comment block to output the EMA values onto the chart. It looks like this...

      0_1602882587846_f73d46c7-9846-4d33-95f4-1b7943749eb4-image.png

      However, on that same candle MT5 reports the EMA values like this...
      0_1602882627848_835bc831-a2b4-44bf-9b00-6afa146d8b53-image.png

      So the EA seems to be ignoring that last digit or rounding (pretty sure it's rounding based on other examples I've seen). As a result, the cross is never detected.

      If needed, I could create a very simple EA that just looks for an EMA cross and demonstrate how it doesn't capture ALL crosses.

      posted in Bug Reports
      S
      sidmcfarland
    • Indicator rounding and cross (x> and x<) logic

      After some extensive testing, it seems there is a bug with how X> and X< behaves related to indicator values... especially when those indicator values are very close together. Based on observation, this appears to be due to rounding. The result is that not all X> and X< events are captured. Let me explain.

      I have this condition block, which checks to see if EMA(8) crossed above EMA(13) in the previous candle (Candle ID = 1)...
      0_1602880923797_83725224-3c1e-4573-b973-3687472781ad-image.png

      When I backtest this EA in MT5 I see indicator values that look like this (last four bars)...

      Candle ID = 3 (3 candles ago)
      0_1602881218737_5fb6961a-cb61-40bf-8ad1-edcbf07e802d-image.png
      Candle ID = 2 (2 candles ago)
      0_1602881132844_c24da54b-87e3-494c-8b15-d4a51fa9f3b4-image.png
      Candle ID = 1 (1 candle ago)
      0_1602881279634_80899cab-4aa7-47b2-9bab-045ad80321bb-image.png
      Candle ID = 0 (current candle)
      0_1602881453700_db12a21f-cf08-4fbf-ac57-853f976eefd0-image.png

      Notice how EMA(8) is below EMA(13) for candle 3 and candle 2, but then climbs above it on candle 1 and further above on candle 0. The cross happens on candle 1. That is... it SHOULD happen. But it does not. The condition is never met in the EA. And based on reviewing several such examples, it seems to be related to rounding. It seems that the EA treats EMA(8) and EMA(13) as the same value since they both round to 1.17582, and as a result the "greater than" (>) comparison in the MQL code results in a FALSE value. As such, the cross is never detected.

      At least... that's what SEEMS to be going on. Thoughts? How do I make sure ALL of my EMA crosses produce a trigger every time... even when the difference between the EMA values is a fraction of a point? Do I need custom MQL code block and/or some variables to store the EMA values so that this rounding doesn't occur?

      posted in Bug Reports
      S
      sidmcfarland
    • RE: RANDOM NUMBERS

      The answer given by @miro1360 is not quite correct and overly complicated. It unnecessarily checks itself and tries again whenever it generates a number outside of the 10-100 range. So why not instead update the block that generates the number so that it never generates a number outside of the 10-100 range? Also, you should not divide by 32768 because the max of MathRand() is 32767. Dividing by 32768 means you will sometimes get a value larger than 100. Additionally, this random number generating actually produces numbers 10-110, which is probably why there is a block to check if the value is within range. I feel my example is better and simpler. It also properly seeds the random number generator.
      0_1594473750244_Random.png

      posted in Questions & Answers
      S
      sidmcfarland
    • 1 / 1