Condition Using Historical Data
-
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) -
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 ... westfromtowell, they are a little bit complicated, but if you understand coding a little, you can perhaps get the idea

-
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)
-
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?
-
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
-
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

-
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.
-
... is this correct usage of Levels Tester?: http://fxdreema.com/shared/LNF86z5S
-
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. -
ok, sorry I'm learning but still a beginner - can you show me an example of how to connect formula?
-
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.
-
__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?
-
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...
-
looks like the monthly data is there and goes back 5+ years. Seems to be working now, thanks.