Hi
I have a few questions:
1) Is it possible to get the exit price generated by a strategy in the indicator.
2) Is there a way of getting the orders from the chart hint window in the indicator?
Any assistance at all would be very helpful.
Thanks
How to get the exitprice in the indicator
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to get the exitprice in the indicator
Dear flyinglight,
1) In strategy - original code + the following line:
How to get exitprice in indicator:
2) This is not possible, strategy does not have direct access to this info.
1) In strategy - original code + the following line:
Code: Select all
GVSetNamedInt("ExitPrice", exitprice);
Code: Select all
var: exit_price(0);
GVGetNamedInt("ExitPrice", exit_price);
plot1(exit_price);
-
- Posts: 2
- Joined: 25 Aug 2010
Re: How to get the exitprice in the indicator
Is it possible that DLL get the orders on the chart or the hint window?
I would like to know how to get the orders, using functions or interfaces like IEasyLanguageObject provided by the EasyLanguage Extension SDK.
Thanks a lot
I would like to know how to get the orders, using functions or interfaces like IEasyLanguageObject provided by the EasyLanguage Extension SDK.
Thanks a lot
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to get the exitprice in the indicator
Dear flyinglight,
Unfortunately, this is not possible. There are no interfaces for orders there.
Unfortunately, this is not possible. There are no interfaces for orders there.
Re: How to get the exitprice in the indicator
Dave, you just gave me an idea. If I can be guaranteed that even on multi-core processes a strategy is always executed before an indicator on the same chart on each tick update, then I could put all my code in the strategy and pass only what I need to plot on the chart to an indicator using global variables. So, is that guarantee valid?Dear flyinglight,
1) In strategy - original code + the following line:How to get exitprice in indicator:Code: Select all
GVSetNamedInt("ExitPrice", exitprice);
Code: Select all
var: exit_price(0);
GVGetNamedInt("ExitPrice", exit_price);
plot1(exit_price);
Re: How to get the exitprice in the indicator
BTW, the code above is incorrect. It should be:Code: Select all
var: exit_price(0);
GVGetNamedInt("ExitPrice", exit_price);
plot1(exit_price);
Code: Select all
var: exit_price(0), error_code(0);
exit_price = GVGetNamedInt("ExitPrice", error_code);
plot1(exit_price);
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to get the exitprice in the indicator
Dear janus,So, is that guarantee valid?
Unfortunately, there is no such guarantee.
Re: How to get the exitprice in the indicator
That's a pity. Something should be done in a future release to allow linkages of studies to be coordinated to realise the full potential of global variables. Otherwise, global variables will always be unpredictable and unreliable for exchanging information between studies, and be of little value for most situations.Dear janus,So, is that guarantee valid?
Unfortunately, there is no such guarantee.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to get the exitprice in the indicator
Dear janus,
Generally, there is no order in the calculation of the scripts, but you can set it up the way that strategies will be calculated before a particular indicator. All you need to to do is use the keywords for strategies in this indicator. For example, write in this indicator. Then you will have such guarantee.
Generally, there is no order in the calculation of the scripts, but you can set it up the way that strategies will be calculated before a particular indicator. All you need to to do is use the keywords for strategies in this indicator. For example, write
Code: Select all
value1=i_MarketPosition;
Re: How to get the exitprice in the indicator
Three points need clarification:..but you can set it up the way that strategies will be calculated before a particular indicator. All you need to to do is use the keywords for strategies in this indicator. For example, writein this indicator. Then you will have such guarantee.Code: Select all
value1=i_MarketPosition;
1. Will any of the 8 or so keywords starting with "i_" provide such a guarantee?
2. Using any of them in an indicator will force the strategy to be run before the indicator, not after the indicator? Is this because the indicator relies on the strategy to gather the information so it must wait for the strategy to run first?
3. This synchronization between an indicator and a strategy only applies when they are on the same chart window, worksheet, or anywhere?
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to get the exitprice in the indicator
Dear janus,
Let me answer your questions one by one:
1. Yes.
2. Yes, that's correct.
3. One chart window.
Let me answer your questions one by one:
1. Yes.
2. Yes, that's correct.
3. One chart window.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to get the exitprice in the indicator
Dear flyinglight,
1) In strategy - original code + the following line:How to get exitprice in indicator:Code: Select all
GVSetNamedInt("ExitPrice", exitprice);
[..]Code: Select all
var: exit_price(0);
GVGetNamedInt("ExitPrice", exit_price);
plot1(exit_price);
Should this still work in MultiCharts Version 7.0 Release (Build 4510)? From my testing it doesn't work.[..]
BTW, the code above is incorrect. It should be:Code: Select all
var: exit_price(0), error_code(0);
exit_price = GVGetNamedInt("ExitPrice", error_code);
plot1(exit_price);
My strategy contains this..
Code: Select all
GVSetNamedInt("ExitPrice", exitprice(1));
Print("Exitprice: ", exitprice(1));
Code: Select all
var: exit_price(0), error_code(0);
exit_price = GVGetNamedInt("ExitPrice", error_code);
plot1(exit_price);
Print(spaces(3), " indicator: ", exit_price);
Suggesting that the indicator gets calculated when the strategy is done calculating, which prevents the indicator from using the value provided by the strategy. This is confirmed by the 'backtest done' line, which is printed in the strategy in the LastBarOnChart statement.Exitprice: 1.45
Exitprice: 1.45
Exitprice: 1.45
Exitprice: 1.45
Exitprice: 1.45
85453.00 - Backtest done!
indicator: 1.00
indicator: 1.00
indicator: 1.00
indicator: 1.00
Another example
Strategy:
Code: Select all
vars: SetGV(0), GetGV(0);
SetGV = GVSetNamedDouble("myClose", close);
GetGV = GVGetNamedDouble("myClose", value1);
Print(date:0:0, " ", time_s:0:0, " close: ", close:0:5, " Set GV value: ", SetGV, " Get GV value: ", GetGV:0:5);
Code: Select all
vars: GetGV(0), message(0);
GetGV = GVGetNamedDouble("myClose", message);
Print(date:0:0, "_", time_s:0:0, Spaces(3), " calling from Indicator. GV: ", GetGV:0:5, " error code: ", message);
Plot1(GetGV, "GV");
What am I missing, or can GlobalVariables only be used in real-time?1110726 115705 close: 1.44698 Set GV value: 0.00 Get GV value: 1.44698
1110726 115822 close: 1.44694 Set GV value: 0.00 Get GV value: 1.44694
1110726 115908 close: 1.44746 Set GV value: 0.00 Get GV value: 1.44746
1110726 115957 close: 1.44755 Set GV value: 0.00 Get GV value: 1.44755
1110726 115959 close: 1.44754 Set GV value: 0.00 Get GV value: 1.44754
1110630_231525 calling from Indicator. GV: 1.44754 error code: 0.00
1110630_231715 calling from Indicator. GV: 1.44754 error code: 0.00
1110630_232012 calling from Indicator. GV: 1.44754 error code: 0.00
1110630_232446 calling from Indicator. GV: 1.44754 error code: 0.00
Re: How to get the exitprice in the indicator
[quote="JoshM"]
[b]What am I missing, or can GlobalVariables only be used in real-time?[/b][/quote]
Josh,
GV works only realtime. Take a look at this post on bigmike: http://www.bigmiketrading.com/multichar ... #post33044
It contains a ADE version of a saver and loader modified by MC engineer ALEX so it can transfer data and marketposition between tick charts. For normal intraday interval you need to modify it a little bit.
[b]What am I missing, or can GlobalVariables only be used in real-time?[/b][/quote]
Josh,
GV works only realtime. Take a look at this post on bigmike: http://www.bigmiketrading.com/multichar ... #post33044
It contains a ADE version of a saver and loader modified by MC engineer ALEX so it can transfer data and marketposition between tick charts. For normal intraday interval you need to modify it a little bit.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to get the exitprice in the indicator
Thanks SP - for both confirming that GlobalVariables don't work on historical data and for the interesting link; will look into that. Thanks.GV works only realtime. Take a look at this post on bigmike: http://www.bigmiketrading.com/multichar ... #post33044
It contains a ADE version of a saver and loader modified by MC engineer ALEX so it can transfer data and marketposition between tick charts. For normal intraday interval you need to modify it a little bit.