fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Comparing last order close time to amount of closed candles since order was closed

    Questions & Answers
    2
    2
    579
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      eggran last edited by

      I am trying to test a re-entry option for my EA that places another trade if the previous trade was closed due to stop-loss at least 'x' candles ago, and if the current greater timeframe indicator is still in a specified state, and if the current price is still a certain level.

      Problem Scenario:
      Let's say the normal conditions require two MA's to crossover 1 candle ago. They bullishly do so and trigger a buy.
      Price moves sharply lower and triggers stop-loss.
      Price recovers and continues upwards, but I miss out on any profit because the conditions that triggered a buy in the first place have passed since the crossover now happened more than 1 candles ago.

      A possible solution to enjoy some of the profits are to re-renter a long position as long as certain conditions are met (for example, as long as a higher time pair of MA's still move bullishly and as long as the price is still above the slower MA)

      2 Questions:

      #1
      I am not confident that I built the blocks correctly to accomplish this. Specifically, the "ticket <= ReEntry Candle" block.
      Should this be >=? Is this even the correct approach?

      #2
      The example I'm linking to assumes initialization of a M5 chart and uses the M15 chart as the higher timeframe reference. I haven't figured out how to set blocks to reference a constant setting's higher timeframe (can I just enter the minute integers in a constant like (1,15,60,240), and fxdreema will interpret that as (M1, M15, H1, H4)?

      shared link: https://fxdreema.com/shared/hFh8N23Gb
      screenshot:
      0_1509770367564_Screen Shot 2017-11-03 at 9.39.10 PM.png

      Thanks!

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        If you want to check how old is some trade, using pink blocks, there is a block "check age" which can be used and it feels more naturally.

        If you want to create input parameter for the EA where you can select different timeframes, you can make it with data type ENUM_TIMEFRAMES. As a default value you can have PERIOD_M15, which is a predefind constant. Here is more info: https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post

        Online Users

        A
        I
        A
        E
        S
        E
        J
        2
        C
        R

        32
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors