Hi,
Thank you for your continual support and help. It is very much appreciated.
I am trying to write this code in QS but can't figure it out. Please provide a code snippet to help.
We are using daily data.
a = Lastweek's high
b = This week's low
c = EMA(close, 50); // ---- Daily EMA at the end of this week
d = EMA(close+5, 50); // ---- Daily EMA at the end of last week
Functions such as "timeframeapply" allows you to access other time frame data. However, you will be able to access weekly bar data for example only when it is completed and thus "this week low" cannot be accessed.
You need to write something like this:
a = timeframedecompress(timeframeapply(7, high));
a = ref(a, 1);
nw = week() != ref(week(), 1);
b = lowestsince(nw, low);
Accessing daily data in weekly time frame is not possible unless a custom c# code is written in "Tools -> Create Functions".
In the script editor, use CONTROL+SPACE to display the list of available functions at any moment. Click on the "Help" red button at the bottom of the script editor.
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.