I would like to "manually/discretionary" place positions on a chart, on bars that already are part of the history data.
What is the use-case?
As a Multicharts user, I am not too happy with their market replay functionality which got left behind in terms of integration with some more exotic features MC has released. For example, while in play-back you cannot place trades on the chart.
Consequently, my way to practice off-line sim-trades is just by scrolling a chart back to its first page of bars, and progressing the chart bar by bar to the right. I usually place arrows to mark entry/exit points in the market, and I do scale out.
It would be great to have an indicator (let's say), that would read the arrows I place on the bars and issue entry/partial exit/exit decisions that I could later analyze in Multichart's performance report.
I'm not sure such an indicator exists, or whether a different solution exists.
Potential solutions I see? :
- Add the ability to place trades while in play-back
- Build such an indicator as described above (able to read some custom drawings and issue signals)
- Build some new custom orders that could be placed on history-data bars (for sim-trading purposes only, of course)
Time pressure is the main problem preventing me to further work on it. Still, whenever I'll have more time, or for anyone willing to contribute, I would like to enhance it with:
- Adding an automatic self-update whenever a new arrow / set of arrows (for a round-turn) appear on the chart.
- A stop-loss option to an entry order
- Scale-in option. Right now, it only supports scale out
I was reading the list of new items in Multicharts 9.0 beta 1 and I noticed a new function:
It uses the ID number of the arrow.
I'm pretty sure we could use this for a simplification and evolution of your code and it would no longer need the switch/case stuff,
use a variable say, value1
Set that variable to 1
If Arw_Exist(value1) then begin
[insert whatever code we like here such as using Arw_getbarnumber(value1) to get the bar number which we could then compare with currentbar and doing things with it such as buying/shorting etc]
then set value1 = value1 + 1
Once it iterates through the entire number of arrows it would end the code.
One thing I found with the switch/case ordering in your code was that it was not accepting stop or limit orders on the next bar. Perhaps it would also be easier to do the scaling in and stop loss orders without switch/case ??
If I get a chance, I'll knock together a beta and put it here for you to test Andby
Turned out that new function Arw_Exist was not that useful for this purpose.
However, I turned instead to Multicharts "indicators or indicators" feature that is a workaround to avoid the switch/case method.
What I've done is the following:
1. Created an indicator leveraging some of your code called ArrowCatcher. This detects where the manual arrows are, their direction and also converts the text in the arrow into a numeric format. It outputs two plots - plot1 being the arrow direction (-1 for down arrow, 0 for no arrow or 1 for up arrow) and plot2 - being the numeric translation of the arrow text
2. A signal called ArrowSignals_NoScale that uses those Plots 1 and 2 to enter and exit trades WITHOUT scaling. It does have basic stops (stoploss/breakeven/profittarget/percenttrailing) included that the user can choose through the inputs.
NB in this version, the arrow text can either be inserted as blank, 0, 1 or 2. If blank or zero then the order is executed this bar on close. If 1, then a limit order the next bar using an ATR function to approximate half way along the next bar. If 2, then a stop order the next bar again using an ATR function to approximate half way along the next bar. [Obviously, this could be recoded to eg a few ticks above or below the last close]
3. A signal called ArrowSignals that again uses those Plots 1 and 2 to enter and exit trades WITH scaling - up to three tranches of scaling IN and OUT. It has the same basic stops. However, you should note that stoploss/breakeven can only be done on a position and not tranche basis in this code. Otherwise it was too complex and timeconsuming for this iteration of code.
NB in this version, the arrow text sets the size of the order and all orders are done at close of this bar. I have not set a maximum number of contracts for the entire position but that would be pretty easy to build into the code and you can also use the Multicharts signal properties I believe.
If you get a chance can you please test this Beta. I think it works but your mileage may vary
PS Whilst I don't know how to get the strategies to auto-recalculate I have assigned a keyboard shortcut to "Recalculate Strategy" to make it as easy as possible to do this manually
A word of thanks to a post by ABCTradingGroup that helped with my education on linking orders in Easylanguage.
Last edited by hoolio; June 23rd, 2014 at 01:58 PM.
Reason: Added detail
The following 2 users say Thank You to hoolio for this post:
It's a good progress indeed, and thanks for picking this up
Whilst I'm hammered with some work and traveling non-stop for the moment, will test it soon.
Multicharts 9 beta 2 is out at the moment with some improvements/optimizations.
As another side project, I was also looking at a very good initiative (QUSMA Data Management System : QUSMA) that presents a lot of potential if could be integrated with Multicharts in a way or another. I struggled to understand why most software houses out there, Multicharts included (except AmiBroker) run from integrating free minute/tick data sources (like the minute data from googlefinance).