5 Lots exceeded with TopStepTrader  [SOLVED]

Questions about MultiCharts and user contributed studies.
Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

5 Lots exceeded with TopStepTrader

Postby Adrian Uncle » 22 Sep 2016

Hi there,

I am using the following code for my stoploss and takeprofit but it may be causing a problem with TopStepTrader. Is there any alternative to it?

Code: Select all

SETPROFITTARGET (ProfitTarget*NumberOfContracts) ;
SETSTOPLOSS (StopLoss*NumberOfContracts) ;
TopstepStrader is only allowing me to trade a maximum of 5 lots and all my orders are based on limit orders. For some reasons, Rithmic (TopStepTrader) is rejecting my order and causing my auto trading script to shut down after 100 rejection (Rejected at RMS).

Case 1. If I placed a limit order to buy 2 lots at xzy price, if the price does not hit the limit price, then I am not in the market. This should be counted as zero trading lots since I am not holding any positions.

Case 2. I am long the market with 2 buy lots, then the number of contracts for me is 2 lots since I am holding a position with 2 lots.

Case 3. I am long the market with 2 lots, and I have a stop loss limit of 2 lots and also have a take profit limit of 2 lots. Does this situation count as 6 lots with MC and my SL and TP coding? If the price goes up, it will hit my profit limit of 2 lots and I would have zero lot opens. Being that the profit limit was taken place, the stoploss limit would be voided/cancelled since there is no longer a trade to stoploss. If the price goes down, it would hit my stoploss and I would have zero lots open. The take profit limit would be voided/cancelled since there is no longer a trade to takeprofit.

Case 4. I am long the market with 2 lots, and I have a stop loss limit of 2 lots and also have a take profit limit of 2 lots. I then place a reverse sell limit (reverse position) of 4 lots. Does this count as 10 lots? The situation here is that I am only holding 2 long lots. If the reverse sell limit is hit, my 2 lots long are turned to 2 lots sell and I would have 2 lots short position in the market. My stoploss and take profit limit for the buy position are voided/cancelled since I am no longer in a buy trade. A new stop loss and takeprofit will be entered for the new 2 lots short.

From the cases above, I am not exceeding TopStepTrader 5 lots limit. Unless my code or MC platform is doing something strange. See attached, rejected at RMS message.
Attachments
Screenshot.png
Screenshot.png (121.63 KiB) Viewed 1302 times

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: 5 Lots exceeded with TopStepTrader

Postby bensat » 23 Sep 2016

For me it looks like your logic & code always adds/sets another STOP order to the once already set and this one gets rejected. You add so many sell limits to the original <STOP> order (which never got rejected) that any other sell <LIMIT> or <STOP> order would set you off. You are trying to add & add and add sell orders till you get a <SELL> filled of 4 contrats which sets you -2 in position.

So your constant rejection of 1 STOP order is correct from what you are sharing ... For some reason your code sets constantly another +/- 2 contracts stops order which sets you in trouble.

Image

Kind Regards.

Ben

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 80 times
Contact:

Re: 5 Lots exceeded with TopStepTrader

Postby tony » 23 Sep 2016

I believe if you exceed 9 rejections Rithmic threatens to shut off your account due to excessive messaging.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: 5 Lots exceeded with TopStepTrader

Postby Adrian Uncle » 23 Sep 2016

For me it looks like your logic & code always adds/sets another STOP order to the once already set and this one gets rejected. You add so many sell limits to the original <STOP> order (which never got rejected) that any other sell <LIMIT> or <STOP> order would set you off. You are trying to add & add and add sell orders till you get a <SELL> filled of 4 contrats which sets you -2 in position.

So your constant rejection of 1 STOP order is correct from what you are sharing ... For some reason your code sets constantly another +/- 2 contracts stops order which sets you in trouble.

Image

Kind Regards.

Ben
Ben,

I am currently using this code for stoploss and takeprofit. Is there another way to code my SL and TP

SETPROFITTARGET (ProfitTarget*NumberOfContracts) ;
SETSTOPLOSS (StopLoss*NumberOfContracts) ;

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: 5 Lots exceeded with TopStepTrader

Postby bensat » 23 Sep 2016

One another thought from my side, which may could have significant impact on your order process. Did you see these rejected orders occurred when your strategy tried to reverse or close the current position before any of your limits/stops where hit ?

I am asking because the rejected orders are coming from nowhere at any time and it's always the size of your current position. So may the strategy tries to exit the current position, but this order is rejected due to the other orders already set. It seems to be working if your exit limit or exit stop of your current position is hit.

It sends the exit order first and cancels the others. That's why they get cancelled at the same time & moment. You can see that at <Create Time> & <Update Time>.

Try with just one contract and it should work ...

Kind Regards.

Ben

User avatar
Alex MultiCharts
Posts: 194
Joined: 09 Aug 2013
Has thanked: 43 times
Been thanked: 76 times

Re: 5 Lots exceeded with TopStepTrader

Postby Alex MultiCharts » 23 Sep 2016

Hello Adrian Uncle,

As you have sent this request via email also, we are investigating the issue and will proceed the discussion using emails.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: 5 Lots exceeded with TopStepTrader  [SOLVED]

Postby Adrian Uncle » 25 Sep 2016

Hi,

I am posting the reply from TopStepTrader and also my solution. I hope that it can also help others.

Case 1. If I placed a limit order to buy 2 lots at xzy price, if the price does not hit the limit price, then I am not in the market. This should be counted as zero trading lots since I am not holding any positions. <-- This is incorrect. You are working 2 buy orders, therefore 2 contracts are counted against your Max Buy.

Case 2. I am long the market with 2 buy lots, then the number of contracts for me is 2 lots since I am holding a position with 2 lots. <-- Correct. 2 contracts long count 2 against Max Buy.

Case 3. I am long the market with 2 lots, and I have a stop loss limit of 2 lots and also have a take profit limit of 2 lots. Does this situation count as 6 lots? <-- 2 Buy + 2 Sell + 2 Sell = 2 Sell against Max Sell

Case 4. I am long the market with 2 lots, and I have a stop loss limit of 2 lots and also have a take profit limit of 2 lots. I then place a reverse sell limit (reverse position) of 4 lots. Does this count as 10 lots? <-- 2 Buy + 2 Sell + 2 Sell + 4 Sell = 6 Sell against Max Sell. If the Max Sell Limit is set to 5 contracts, then the "reverse sell limit order for 4 contracts" would be rejected.

Below is my proposed solution. Please let me know if you come across a better solution. Since my stoploss is -$700 and my takeprofit is $250, I don't want the limit order to be placed unless it is closer to the tp or sl price.

Code: Select all

if OpenPositionProfit > 180 then SETPROFITTARGET(ProfitTarget*NumberOfContracts);
if OpenPositionProfit < -630 then SETSTOPLOSS(StopLoss*NumberOfContracts);

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: 5 Lots exceeded with TopStepTrader

Postby bensat » 26 Sep 2016

The issue is that any order reversing your current position is exceeding your limits, no matter when you set the limit order, but I understand your intentions. As far as I'm concerned, any platform executes the 'closing/reversing' order of the position first and cancels all other orders, related to the previous position, after.

Easiest solution would be TSSupport would give us exclusive access to any order set by Multicharts for modifying orders.

Another solution would be to split execution into different strategies. Further I would set a target & stop for specific amount of ticks and not SETPROFITTARGET/SETSTOPLOSS per contract. Activate <intrabar order generation> for stop order and limit order. Further I would set a <pseudo MIT> order or <pseudo LIT> order for <LIMIT> exit or just lower your <STOP> order to exit at <LIMIT + 1tick>.

To reverse an order you could just move the <STOP> to <entry price +1tick> and double the contracts for the stop. You could work with Bid-Ask as well etc.

I think you get me. But these solutions include that you have separated entry & exit strategies in Multicharts. Exits/Reversals have to be set to allow <intrabar order generation>.

Image

Kind Regards

Ben

User avatar
Alex MultiCharts
Posts: 194
Joined: 09 Aug 2013
Has thanked: 43 times
Been thanked: 76 times

Re: 5 Lots exceeded with TopStepTrader

Postby Alex MultiCharts » 26 Sep 2016

Hello Adrian Uncle,

Thank you for the provided information, glad to know that you have found the solution. As the orders are rejected by the broker and only they can say how the orders are considered and processed on their end in your particular case.

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: 5 Lots exceeded with TopStepTrader

Postby Adrian Uncle » 26 Sep 2016

The issue is that any order reversing your current position is exceeding your limits, no matter when you set the limit order, but I understand your intentions. As far as I'm concerned, any platform executes the 'closing/reversing' order of the position first and cancels all other orders, related to the previous position, after.

Easiest solution would be TSSupport would give us exclusive access to any order set by Multicharts for modifying orders.

Another solution would be to split execution into different strategies. Further I would set a target & stop for specific amount of ticks and not SETPROFITTARGET/SETSTOPLOSS per contract. Activate <intrabar order generation> for stop order and limit order. Further I would set a <pseudo MIT> order or <pseudo LIT> order for <LIMIT> exit or just lower your <STOP> order to exit at <LIMIT + 1tick>.

To reverse an order you could just move the <STOP> to <entry price +1tick> and double the contracts for the stop. You could work with Bid-Ask as well etc.

I think you get me. But these solutions include that you have separated entry & exit strategies in Multicharts. Exits/Reversals have to be set to allow <intrabar order generation>.

Image

Kind Regards

Ben
Great ideas. Thanks Ben.


Return to “MultiCharts”