Ive recently gotten into using multicharts, and I have one query, which may or may not have already been asked on this forum. Ive searched and found similar stuff, but nothing that answered my query.
What I want to do is chart an instrument using 2 time frames, but trade on a 3rd time frame. i-e, track the movement of an instrument simultaneously on the daily and weekly timeframes, and when a trigger is hit on these timeframes, trade on the 10 minute bar.
How can i do this?
Last edited by bondstrader; September 25th, 2014 at 02:22 AM.
On a related note, when I plot the above time frames on a chart window, what does the 'Base Study On' part mean? If Im trading on the 10 min bar while using the information from the daily and weekly bars, which time frame should i 'base study on'?
The following user says Thank You to bondstrader for this post:
you are welcome. "Base study on" only comes into play with indicators and I would suggest to base it on the datastream that gives the most updates and adapt the code accordingly. This would also be my suggestion for a signal - use the fastest datastream as data1 and adapt the signal accordingly. If your trade datastream is not the fastest stream on the chart it's usually less hassle to use an additional faster datastream of the same symbol for trade execution and use the "original" trade datastream for generating the signals.
Of course you can make it work when data1 is not the fastest chart, but it's usually harder and more work than doing what I wrote above.
The following user says Thank You to ABCTG for this post:
Thanks a lot for your help so far ABCTG......
Im having quite a few issues with multi time frames, so your help is a god-send.
Below is a basic version of the code Im trying to implement. data1 is the daily chart, and data2 is weekly. The signal is supposed to trigger a trade whenever the high bars of the 2 charts are crossed.
However, it doesnt always happen that way. I cant attach a screenshot as I have less than 5 posts..but there are many trades that triggered even though both the high bars were not breached.
Plus, Ive added a condition for max position to be 10, but that doesnt seem to matter either, as the strategy runs away with trades Any ideas?
marketposition can only have one of three values - 0 if you are flat, +1 if you are long and -1 if you are short.
Therefore your condition is always true and the signal keeps adding trades.
You are looking for something like "CurrentEntries".
From looking at your code it's not exactly clear what you are trying to get at - you are using intrabar order generation, but none of the variables is intrabarpersist (which might not be needed, but I thought I'd point it out). Besides that you should tie variables to data2 specifically on declaration in my opinion.
The next thing would be for you to add print statements to your code to debug what exactly the values are at the point of an entry. This will help you figuring out what is happening in your code and what is different than what you want it to do.
The following 3 users say Thank You to ABCTG for this post: