fxDreema

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

    Condition Using Historical Data

    Questions & Answers
    2
    14
    2357
    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.
    • T
      Trader3487 last edited by

      Is there a way to write a condition that says one of the following?:

      example 1: If close [0] > 5-year high
      example 2: If close [0] < (5-year low/2)- (5-year low/4)

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

        Whooo, 5-years, here I smell history data issues. In my backtester the biggest TF is Daily, on live it is Monthly, but knowing the numbers of candles to use... check in Condition, somewhere in "Market properties" for highest/lowest price for candles period (also choose timeframe there). You can also create a custom block for these calculations, otherwise Formula blocks should be used. And use calculations in "on Init" if there is no need to reaclculate often. But if you know the actual highest/lowest prices and you can write them manually, I recommend to use them directly. 5 years is so big period, that somehow does not deserve calculations. And once when you reach price over/below the limits, then you work on lowest scale, but of course this depends on the strategy.

        In case you are interested in coding, here are the functions that currently calculate highest, lowest prices:

        http://fxdreema.com/documentation/colle ... hestfromto
        http://fxdreema.com/documentation/colle ... westfromto

        well, they are a little bit complicated, but if you understand coding a little, you can perhaps get the idea 🙂

        1 Reply Last reply Reply Quote 0
        • T
          Trader3487 last edited by

          http://fxdreema.com/shared/dKRmozGJ

          I think this correctly expresses: If close [0] < (5-year low/2), right?
          Now, how do I add the part that says "+ (5-year low/4)"? For example, let's say highest value for last 5 year is 2, condition should check if close [0] > 1.5

          (example 2 from first post in this thread was actually example 2: If close [0] < (5-year low/2) + (5-year low/4) with "+" sign in between instead of "-" sign)

          1 Reply Last reply Reply Quote 0
          • T
            Trader3487 last edited by

            maybe this works?: http://fxdreema.com/shared/wvb04F7yc

            Is there a way to print the value of this condition in order to test if it's working?

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

              Start candle should be the one with lowest ID. Better select specific timeframe. Adjust is fine, it should work, but candles to be used are so many, so check for error messages eventually.
              Check "Levels tester" block, it's near the top 🙂

              1 Reply Last reply Reply Quote 0
              • T
                Trader3487 last edited by

                Why would history data be an issue? Can it only read a certain number of candles back? What type of errors would I be looking for? Thank you 🙂

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

                  I don't know, I never tested with so much candles, so if you do it - check twice if all values are ok before using them.

                  1 Reply Last reply Reply Quote 0
                  • T
                    Trader3487 last edited by

                    ... is this correct usage of Levels Tester?: http://fxdreema.com/shared/LNF86z5S

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

                      Levels tester is only to check what is going on, normally it should be on top level (to show you everything), but in this case it can be used this way.
                      Block 2 looks disconnected to me, it will not be added to the final project.

                      1 Reply Last reply Reply Quote 0
                      • T
                        Trader3487 last edited by

                        ok, sorry I'm learning but still a beginner - can you show me an example of how to connect formula?

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

                          Ummm... you have 3 blocks, two of them are connected and one of them is not. In fxDreema not-connected blocks are not included to the final file. Just connect it like other two are connected - drag orange circle to white circle.

                          1 Reply Last reply Reply Quote 0
                          • T
                            Trader3487 last edited by

                            __Whooo, 5-years, here I smell history data issues. In my backtester the biggest TF is Daily, on live it is Monthly, but knowing the numbers of candles to use...

                            well, now I see what you mean about history data issues (because mt4 doesn't have access to 5 years of data for all time frames). Do you think loading tickstory data will solve the problem?

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

                              You don't need all timeframes, but the biggest one - Monthly in live or Daily in backtester. I don't know about tickstory, I tested it once... long time ago...

                              1 Reply Last reply Reply Quote 0
                              • T
                                Trader3487 last edited by

                                looks like the monthly data is there and goes back 5+ years. Seems to be working now, thanks.

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

                                Online Users

                                E
                                T
                                M
                                U
                                S
                                F

                                12
                                Online

                                146.7k
                                Users

                                22.4k
                                Topics

                                122.6k
                                Posts

                                Powered by NodeBB Forums | Contributors