Hello there
I was wondering if anyone can help with this issue
I have built a strategy that runs on 5Min charts. What I am trying to do is to have the strategy check with signals from other charts ( 30 minutes, Daily etc) before firing up a signal.
Does anyone know know how to do that without opening multiple charts for each market?
Thank you
Help with strategy [SOLVED]
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Help with strategy [SOLVED]
The way I understand you, this isn't possible. You'll need to open multiple charts with the other markets and then have a script on those charts communicate the data through a global variable to the original signal script.What I am trying to do is to have the strategy check with signals from other charts ( 30 minutes, Daily etc) before firing up a signal.
Does anyone know know how to do that without opening multiple charts for each market?
It's unfortunately not possible to access data from other markets without opening a chart for that market and adding a script to that chart.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Help with strategy
It's quite easy actually. There are several functions in the PowerLanguage Editor by default that start with GV.That global variable you talking about. What is it and is it difficult to build?
You can one of those functions to send data to another script:
Code: Select all
// Send data to another script
GVSetNamedDouble("lastClosePrice", close);
Code: Select all
// Receive data from another script
GVGetNamedDouble("lastClosePrice", 0);
Two things to keep in mind:
* There are several GV functions with in their name the kind of data they can communicate: string (or str) for text, double for numbers with decimals, int for whole numbers, Boolean for true/false values.
* And global variables only work in real-time, and cannot be used during backtesting.
Re: Help with strategy
You can also reference variables from other data series if you have more than one chart on your WS. If you are trading 5 minute bars but want to reference perhaps a daily bar as part of your conditions for order entry, then create a sub chart and now declare variables for that chart such as varN ( 0, of data2) and so forth. Only problem with doing this in backtesting is if the sub charts are slower time frames then your backtests will have some inaccurate results.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Help with strategy
That's a good idea, but then I would also set the `AllowSendOrdersAlways` attribute to `true` so that orders on the first data series are generated whenever their condition triggers, instead of having MultiCharts 'wait' until the data series are synchronised.You can also reference variables from other data series if you have more than one chart on your WS. If you are trading 5 minute bars but want to reference perhaps a daily bar as part of your conditions for order entry, then create a sub chart and now declare variables for that chart such as varN ( 0, of data2) and so forth.
For more, see the AllowSendOrdersAlways: even submit orders without price updates article.
-
- Posts: 275
- Joined: 22 Apr 2014
- Has thanked: 70 times
- Been thanked: 72 times