fxDreema

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

    Can someone help with this strategy

    Questions & Answers
    3
    7
    373
    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.
    • Domas1988
      Domas1988 last edited by

      Expert Advisor (EA) Summary
      Overview
      This Expert Advisor (EA) is a custom algorithm designed for trading based on candle patterns and moving averages (SMA/EMA). It includes advanced features such as partial position closures at specific Take Profit (TP) levels, Stop Loss (SL) management, and the ability to reverse positions based on certain conditions. It also has a break-even mechanism to secure profits and handles trade management with multiple open positions.
      Key Features:

      1. Candle Pattern Recognition:
        • The EA identifies specific candle patterns on the chart to trigger buy or sell orders. Specifically, it looks for:
          • A buy signal: Two consecutive red candles followed by a green candle.
          • A sell signal: Two consecutive green candles followed by a red candle.
        • These patterns can be filtered using a moving average (SMA or EMA).
      2. Trade Management:
        • Position Opening:
          • Trades are opened based on identified patterns, and can be restricted by a moving average filter if enabled.
          • If the opposite signal is detected, existing positions can be reversed (closed and reopened in the opposite direction).
        • Stop Loss (SL) and Take Profit (TP):
          • SL and TP levels are dynamically calculated based on candle highs/lows and customizable points values.
          • The EA includes three TP levels, where a portion of the position is closed at each level.
        • Break-Even:
          • The EA can automatically adjust the SL to break-even when the price has moved favorably by a certain number of points.
      3. Partial Position Closures:
        • At the first and second TP levels, a specified percentage of the position is closed. The remaining position is left to run until either the third TP level is hit or SL is triggered.
      4. Time-Based Trading Restrictions:
        • The EA can restrict trading to specific hours, preventing the opening of new positions during specified no-trading periods.
      5. Position Management:
        • The EA tracks each open position using a PositionState structure, which includes details such as whether each TP level has been hit and the initial volume of the position.
        • Positions are closed or adjusted (e.g., SL to break-even) based on real-time market conditions.
      6. Graphical Elements:
        • Virtual TP lines and trade lines are drawn on the chart to visualize key levels for each trade.
      7. Customization:
        • Numerous input parameters allow the user to customize the EA's behavior, such as lot size, SL/TP values, percentages for partial closures, and more.
          Logic Flow:
      8. OnTick() Function:
        • The main function that executes on every tick.
        • It checks if trading is allowed based on the time filter.
        • It identifies trading patterns and checks for conditions to open new positions.
        • It manages existing positions, applying break-even adjustments and closing portions of positions at TP levels.
      9. OpenNewPosition() Function:
        • Called to open a new buy or sell position based on the identified pattern.
        • It calculates SL and TP levels, considering candle highs/lows and whether to use a custom SL.
        • It attempts to open the position and set the SL and TP levels accordingly.
      10. ManageOpenPositions() Function:
        • Iterates through all tracked positions to manage them, checking if TP levels are hit and applying partial closures.
        • It also removes positions from tracking once fully closed and applies the break-even logic.
      11. Additional Functions:
        • ApplyBreakEven(): Adjusts SL to break-even when conditions are met.
        • GetMovingAverageValue(): Retrieves the current value of the SMA or EMA.
        • IsTradingAllowed(): Determines if trading is currently allowed based on user-defined time restrictions.
          Recommendations for Code Review and Optimization:
      12. Code Structure:
        • Ensure modularity by encapsulating related logic into functions. This can improve readability and maintainability.
      13. Error Handling:
        • The EA already has some error handling, but it could be enhanced by checking all critical functions (e.g., trade operations) and handling errors consistently.
      14. Performance Optimization:
        • Review the use of Sleep and other blocking calls to ensure they don't negatively impact performance, especially on faster timeframes.
      15. Resource Management:
        • The EA dynamically resizes arrays (e.g., positionStates). Ensure this is done efficiently to avoid performance degradation.
      16. Testing and Debugging:
        • Perform thorough backtesting and forward testing under different market conditions to ensure the EA behaves as expected.
        • Add more debug output, especially for critical decision points, to help trace issues during testing.
          This summary provides an expert overview of how the EA operates, allowing a programmer to understand its logic and focus on cleaning up and optimizing the code for real trading.
      l'andorrà 1 Reply Last reply Reply Quote 0
      • jstap
        jstap last edited by

        This is all possible, some simple, some not but it is hours of work

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

        1 Reply Last reply Reply Quote 0
        • l'andorrà
          l'andorrà @Domas1988 last edited by

          @Domas1988 Are you maybe asking for someone doing it here for free?

          (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

          (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

          (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

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

            Just some suggestions if possible? or for money

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

              I'm struggling with SL movement once it reaches the SL line, i've tried trailing stop and brake even but the SL stays in same place i have no IDEA how to make that buffer.

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

                {Example) Lets say I'm buying and trailing stop moves up! well i want the trailing stop completely in opposite to move down atleast 10 pips if the market goes against me to save the position a little longer. HOW do i do that

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

                  You have these two options, DM people and ask for help through payment, or create a test project, add a shared link to view, describe what it isn't doing and people will give you advice on what's wrong.

                  adding a shared link: project page - projects - create a shared link - open in web page - copy address bar and paste here

                  Learn fxDreema Without the Wait!

                  My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                  The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                  Don’t miss out

                  Click here➡️ https://mybook.to/fxDreema to get your copy today!

                  Enjoy! 😊

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

                  Online Users

                  K
                  M
                  B
                  A
                  C
                  A

                  19
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors