Page 1 of 1

Stop Trading After Daily Gain = {input value}

Posted: Sep 12 2012
by PD Quig
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

Re: Stop Trading After Daily Gain = {input value}

Posted: Sep 13 2012
by SUPER
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.

Vars: TodaysProfit_Loss(0);

if Date <> Date[1] then Value1 = i_ClosedEquity;

Value2 = i_OpenEquity;

TodaysProfit_Loss = Value2-Value1;

Plot1(TodaysProfit_Loss);

Re: Stop Trading After Daily Gain = {input value}

Posted: Sep 13 2012
by PD Quig
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?

Re: Stop Trading After Daily Gain = {input value}

Posted: Sep 14 2012
by Henry MultiŠ”harts
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?
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/.