I've done some searching but am not clear which functions can be used in a strategy in real time and which cannot.
Objective: I want a strategy to stop trading for the day when total equity (closed P&L + open position P&L) > {input value}
Evidently MC does yet not support "GetTodaysRTTradeEquity" function.
Any guidance is appreciated.
-PDQ
Stop Trading After Daily Gain = {input value}
Re: Stop Trading After Daily Gain = {input value}
You can create an indicator to plot your equity values or what ever you want and then use Global Variables to pass this information to your strategy.
for example following indicator plots todays profit/Loss.
for example following indicator plots todays profit/Loss.
Vars: TodaysProfit_Loss(0);
if Date <> Date[1] then Value1 = i_ClosedEquity;
Value2 = i_OpenEquity;
TodaysProfit_Loss = Value2-Value1;
Plot1(TodaysProfit_Loss);
-
- Posts: 191
- Joined: 27 Apr 2010
- Location: San Jose
- Has thanked: 67 times
- Been thanked: 10 times
Re: Stop Trading After Daily Gain = {input value}
Thanks very much for the response. I would have thought that there would be a more direct method of accessing brokerage account data directly from within the strategy without the added overhead--and opportunity for breakage/errors--of creating an intermediary indicator to get the data and then pass it to the strategy.
Anybody know why MC opted not to implement the GetTodaysRTTradeEquity function? I'm guessing that with multiple brokerages supported, they didn't want to mess with multiple APIs?
Anybody know why MC opted not to implement the GetTodaysRTTradeEquity function? I'm guessing that with multiple brokerages supported, they didn't want to mess with multiple APIs?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Stop Trading After Daily Gain = {input value}
This function is not implemented because information for its calculation is not provided in Order and Position tracker. Some brokers can provide it, some cannot. Use the sample code provided by Super above or submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/.Anybody know why MC opted not to implement the GetTodaysRTTradeEquity function? I'm guessing that with multiple brokerages supported, they didn't want to mess with multiple APIs?