"Stop auto-trading after X rejected order" question  [SOLVED]

Questions about MultiCharts and user contributed studies.
wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

"Stop auto-trading after X rejected order" question

Postby wilkinsw » 08 Dec 2014

Hi,

When auto trading is turned off due rejected orders, is the "turning off" exactly the same as when when you make a chart setting change (for example).

Ie, is it detectable by the "broker loss of connection" alert:

Code: Select all

{
ATS Status Monitor; monitors if the Autotrading strategy is turned off, and if yes, gives a sound alert
depending the strategy was turned off with an open position or not.
}

Inputs:
RecalcAfter(15);

Variables:
IntraBarPersist PrevATSStatus(0), // Holds the status of the ATS at the previous update
IntraBarPersist PrevMP(0), // Holds the previous MarketPosition
atsStatus(0), mp(0);

if (LastBarOnChart_s = True) then begin

atsStatus = GetAppInfo(aiStrategyAuto);
mp = MarketPosition(0) * CurrentContracts;

{ If your broker (IB, ZF, Pats) supports it, you might want to replace the line above with the
line below. However, keep in mind that:
"If Automated Trading was manually turned off by the user, the value returned
by the keyword stops changing, and may remain unequal to '0'." (Source: Helpfile)
mp = MarketPosition_at_Broker;
}

// If the current ATS Status differences from the previous, and the previous
// status was ON, give an alert
if (atsStatus <> PrevATSStatus) and (PrevATSStatus = 1) then begin

// If there was a MarketPosition on the previous update, we need to raise a big alarm
if (PrevMP <> 0) then
Alert("atsOffWithOpenMP")

// ... else a lighter alert would be needed
else
Alert("atsOffWithOpenMP");

end;

PrevATSStatus = atsStatus;
PrevMP = mp;

RecalcLastBarAfter(RecalcAfter);
end; //: LastBarOnChart_s = True

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: "Stop auto-trading after X rejected order" question

Postby Andrew MultiCharts » 08 Dec 2014

When auto trading is turned off due rejected orders, is the "turning off" exactly the same as when when you make a chart setting change (for example).
Hello wilkinsw,

I am not sure i understand the question. When the number of orders generated by the strategy with statuses "Rejected" >= X number you specified in the settings of auto-trading, auto-trading is turned off.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: "Stop auto-trading after X rejected order" question

Postby wilkinsw » 08 Dec 2014

Hi Andrew just double checking that turning off auto-trading after x rejected orders means:

"GetAppInfo(aiStrategyAuto) = 0" ?

Thanks.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: "Stop auto-trading after X rejected order" question  [SOLVED]

Postby Andrew MultiCharts » 08 Dec 2014

Hi Andrew just double checking that turning off auto-trading after x rejected orders means:

"GetAppInfo(aiStrategyAuto) = 0" ?
Yes, after the feature "Stop auto-trading after X rejected order" turned off automation, the "GetAppInfo(aiStrategyAuto)" will return "0" on that chart.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: "Stop auto-trading after X rejected order" question

Postby wilkinsw » 08 Dec 2014

Nice feature, thanks.


Return to “MultiCharts”