Stop Trading After Daily Gain = {input value}

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Stop Trading After Daily Gain = {input value}

Postby PD Quig » 12 Sep 2012

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

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

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

Postby SUPER » 13 Sep 2012

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);

PD Quig
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}

Postby PD Quig » 13 Sep 2012

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?

User avatar
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}

Postby Henry MultiСharts » 14 Sep 2012

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


Return to “MultiCharts”