Hi, I am running a system on weekly periodicity. However, I would like to get the Friday daily low and high price.
i tried the formula
L_price = TimeFrameGetPrice("L", inDaily, 0);
h_price = TimeFrameGetPrice("H", inDaily, 0);
but that still gives me the weekly high and low price.
is it because I am running it on weekly periodicity? Is there any way I can get the Friday price running it on weekly periodicity?
thanks in advance for your help.
yes. You can only retrieve prices from a higher timeframe correctly.
As for how? I can only think of these two ways.
Either you can run the formula in Daily Periodicity and adjust all code to compress to weekly
OR run a separate Analysis one time in Daily and TimeFrameCompress() it to weekly with mode = compressLast making sure there are enough bars and store to two static variables ( for high and low ). Then use those in the formula.
May I ask if you HAVE to run your system on weekly? I started with several systems that were weekly to cut down on trade frequency, however I found (through the many excellent programmers on this forum) that I could use daily data to trade a weekly system. For example to trade only on monday open you can find last trading day of a week with a code snippet like:
endofweek=dayofweek()>ref(dayofweek(),1); i.e. day of week on Friday is 5 and it's greater than the first day of next week, so if it's a monday it will be 1. Therefore you can add a condition restricting trade to just 1 day a week and still pull other relevant data. Hope that helps.
thanks @nsm51, i think adjusting the code should work.
Thanks for your suggestion @TonyR. I have never thought of running it on daily periodicity using weekly system. guess i just gave the weekly close price more importance and weightage which also reduces slippage. but will defn take your suggestion into account while working on my present backtesting.
i am not sure if reducing no of trades was the key behind a weekly system. its just that i have seen in a lot of backtesting results that big wealth is made trading the longer timeframes and shorter time frames seem too much work for too little reward. imho, patience is v essential to trade the weekly systems.
You would run your weekly system as per normal - once at the end of the week. But code it to run on a daily periodicity, which gives you access to more data points.
hi @TrendSurfer, got ya. I tried that and to be honest i am blown away with the results. i am sure there is some bug in my code which i cannot recognize. just to give you an idea i am seeing the below results...
Is this even possible? I have used a volume limit of 0.1% of daily bar volume with trade delay of 0 on closing basis.
Going thru my code line by line to spot any bugs. if i cant, will reach out to you and others again.
thanks for you advice and help.