Help with strategy  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
ACMilan
Posts: 53
Joined: 08 Feb 2013
Has thanked: 2 times
Been thanked: 2 times

Help with strategy

Postby ACMilan » 11 Apr 2016

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

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Help with strategy  [SOLVED]

Postby JoshM » 12 Apr 2016

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?
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.

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.

User avatar
ACMilan
Posts: 53
Joined: 08 Feb 2013
Has thanked: 2 times
Been thanked: 2 times

Re: Help with strategy

Postby ACMilan » 12 Apr 2016

Thank you Josh
That global variable you talking about. What is it and is it difficult to build?
V

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Help with strategy

Postby JoshM » 12 Apr 2016

That global variable you talking about. What is it and is it difficult to build?
It's quite easy actually. There are several functions in the PowerLanguage Editor by default that start with GV.

You can one of those functions to send data to another script:

Code: Select all

// Send data to another script
GVSetNamedDouble("lastClosePrice", close);
And then have another script receive that data in real-time:

Code: Select all

// Receive data from another script
GVGetNamedDouble("lastClosePrice", 0);
(If you don't have the `GVGetNamedDouble()` function, you can use the `GVGetDouble()` and `GVSetDouble()` functions too).

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.

User avatar
ACMilan
Posts: 53
Joined: 08 Feb 2013
Has thanked: 2 times
Been thanked: 2 times

Re: Help with strategy

Postby ACMilan » 12 Apr 2016

Thank you
I will try

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Help with strategy

Postby tony » 12 Apr 2016

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.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Help with strategy

Postby JoshM » 22 Apr 2016

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.
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.

For more, see the AllowSendOrdersAlways: even submit orders without price updates article.

hughesfleming
Posts: 275
Joined: 22 Apr 2014
Has thanked: 70 times
Been thanked: 72 times

Re: Help with strategy

Postby hughesfleming » 22 Apr 2016

Hi Josh,

Thank you for that.


Return to “MultiCharts”