The indicator that I've created is based on DAILY data. Instead of using HistoPrice, I have used REF. Therefore, when I add the indicator on my daily chart, it works great. It gives me the correct values.
Now what I am trying to do is use this indicator (based on daily values) on intraday backtesting. In other words, if this indicator was "1" at the end of trading day on MONDAY, I want to buy/sell at 9:30 the next morning.
There are two things I am confused about.
1) settings for the indicator= so when I created this indicator I had used TA.Ref(open,0) and TA.Ref(close,1) in the logic. The "open" and "close" variables were added using the parameter at the bottom:
open=number=open
close=number=close
Like, I said this works beauty when I added it to my chart (the values are correct). But what I don't understand is when I add this indicator on backtesting screen.. it looks like this:
indicatora(open,close)
The "open" and "close" values that show up..by default are they open=0 and close=1 (as I had it in my indicator)[above^]??
What happens if I change it to:
indicatora(0,10) ??
2) Second thing I'm confused about:
How can I implement a indicator that was created using REF (daily values) into a intraday trading strategy.
So lets assume I want to buy when indicatorA = 1 on daily chart when the time is 9:30AM:
interval settings- 1minute
rule1 = indicatora(open,close) > 0;
rule2 = (hour() == 9 and minute() == 30);
buy = rule1 and rule2
the above doesn't work.
I've also tried:
rule1 = indicatora(0,1) > 0; (my first problem described above)
rule2 = (hour() == 9 and minute() == 30);
buy = rule1 and rule2
this also does not work.
Please help! I'm spending way too much time on this lol
The most frustrating thing is that I have a screener and an indicator created for this logic, both work fine, but when I try to backtest it.. it doesnt work!
1) settings for the indicator= so when I created this indicator I had used TA.Ref(open,0) and TA.Ref(close,1) in the logic. The "open" and "close" variables were added using the parameter at the bottom:
open=number=open
close=number=close
Like, I said this works beauty when I added it to my chart (the values are correct). But what I don't understand is when I add this indicator on backtesting screen.. it looks like this:
indicatora(open,close)
The "open" and "close" values that show up..by default are they open=0 and close=1 (as I had it in my indicator)[above^]??
What happens if I change it to:
indicatora(0,10) ??
The "Ref" and "HistoPrice" functions are totally different.
"Ref" references a previous bar. Not matter what time frame you are using.
"HistoPrice" is used with intraday data to reference previous DAILY bars (The daily bars are recreated internally from intraday data).
Regarding the second question, you should add parameters with different names. Try "open1" instead of the internal variable "open" that already exists.
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.