fxDreema

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

    ATR strategy, I'm confused. Help me please.

    Questions & Answers
    2
    2
    733
    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.
    • M
      MieYhR last edited by MieYhR

      I would like to create a stop loss using the ATR strategy but i can't figure out how to set it up.
      In layman's term it would be;
      1.Stop loss: 2.6 * (ATR for instance 0.00036) - current market price.
      2.Take profit: would be the pips between the current price and Stop loss *2

      T 1 Reply Last reply Reply Quote 0
      • T
        trader.philipps @MieYhR last edited by

        @mieyhr I like to use pips rather than price fragments. So how I do it in my projects is:

        1. on Init tab: create a custom MQL code block. Create an double variable (here: dPipsMultiplicator)
          enter the foloowing code:
          //
          dPipsMultiplicator = MathPow(10,_Digits-1);
          //

        0_1570549247905_1f3c0522-ce09-4263-a888-847b18353719-image.png

        1. Create 2 double constants (here: cdSLAtrMult and cdTPAtrMult), so you can change the multiplicator from the EA settings.

        0_1570549218065_06a9d012-4a63-4764-ba7d-504191afdcb6-image.png

        1. on Tick: Create the following sequence

        0_1570549330318_a396f950-c1cb-4f53-aecd-00a1502c9c29-image.png

        I created a comment block that shows me the values of the variables and it looks like that on the chart:
        0_1570550605492_8e800196-8c30-44cc-8d28-eaeb9946eecd-image.png

        Finally you can use the SL and TP eg in a modify Stops block like that

        0_1570550640659_13878391-08b2-4930-b155-6c8a1a13ed0f-image.png

        As I took the parts from my actual project, the last part isn't tested, yet. But I think it will work like that.

        I like to share my knowledge, but expect the others to contribute as well.

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

        Online Users

        E
        H
        E
        J
        S
        W

        17
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors