Can I define a variable that could be used by another signal

Questions about MultiCharts and user contributed studies.
dingmanhoe123
Posts: 61
Joined: 25 Jul 2013
Has thanked: 18 times

Can I define a variable that could be used by another signal

Postby dingmanhoe123 » 12 Mar 2015

As per the subject. For example I have 2 signal in my strategy: 1) LongEntry, 2) stoploss. In LongEntry, I called Buy next bar at market;, In stoploss, I called setstoploss(amt); where amt is calculated in LongEntry signal.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Can I define a variable that could be used by another si

Postby orion » 12 Mar 2015

You can't since all variables have file scope. However, you can communicate from one signal to another via global variables.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Can I define a variable that could be used by another si

Postby TJ » 12 Mar 2015

As per the subject. For example I have 2 signal in my strategy: 1) LongEntry, 2) stoploss. In LongEntry, I called Buy next bar at market;, In stoploss, I called setstoploss(amt); where amt is calculated in LongEntry signal.
Look up:

i_setplotvalue
i_getplotvalue


Return to “MultiCharts”