NexusFi: Find Your Edge


Home Menu

 





What is preventing the strategy to add to my existing position?


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one eros1973ms with 2 posts (0 thanks)
    2. looks_two Jerryflyguy with 1 posts (0 thanks)
    3. looks_3 ABCTG with 1 posts (1 thanks)
    4. looks_4 BD00 with 1 posts (0 thanks)
    1. trending_up 632 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
eros1973ms
florence
 
Posts: 27 since Oct 2011
Thanks Given: 3
Thanks Received: 6

Hi all,

I am trying to insert some position management in my strategy, a very simple one actually: I want to add 1 contract to my existing position if the open profit of the existing contract reaches a certain level.
This should be quite easy, but I don't know why this simple instruction is not doing what it should be. I have already checked through the print log that all the condition all TRUE in some candles, but nothing happens:

 
Code
if 	mp=1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then buy("L-Add") 1 contract next bar at open;

if 	mp=-1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then sellshort("S-Add") 1 contract next bar at open;

This is the print log where I print all my adding conditions, as you see there are the 3 candles of 10:00, 11:00 and 12:00 that satisfy the conditions...but nothing happens

 
Code
print(d," ",t," ",mp," ",openpositionprofit," ",OpenEntryContracts);

Quoting 
1240402.00 700.00 0.00 0.00 0.00 ---> strategy is flat
1240402.00 800.00 -1.00 129.30 1.00 ---> this is the first entry of the strategy
1240402.00 900.00 -1.00 296.30 1.00 ---> starting from here the strategy should add 1 contract to existing position
1240402.00 1000.00 -1.00 371.80 1.00
1240402.00 1100.00 -1.00 337.80 1.00
1240402.00 1200.00 -1.00 224.80 1.00
1240402.00 1300.00 -1.00 249.30 1.00
1240402.00 1400.00 -1.00 248.30 1.00

I also checked the properties of the strategy to see if there was any limitation, but max contract number is actually 65000.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Half-life over Cointegration?
Traders Hideout
Retirement Portfolio Strategy
The Elite Circle
Small Indicator to visually see Nth Bar Close - NT8
Traders Hideout
Quantower Smoothed Heiken Ashi
Platforms and Indicators
Free Supply and Demand Zones Indicator for NinjaTrader 8 …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NinjaTrader Performance on 6 year Laptop Vs. NEW
9 thanks
Tariffs and what comes next...
4 thanks
How to address loneliness for a trader?
4 thanks
Gradient Divergence Trading
4 thanks
Composite Indicator for ninjatrader 8?
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

eros1973ms,

Multicharts requires the user to specifically allow more than one entry in the same direction under the general strategy properties. It will only take one entry by default.
The position limits settings are located on the "Properties" tab of the "Strategy Properties" dialog directly above the "maximum shares/contracts per position" settings that you have already checked.

Regards,

ABCTG


eros1973ms View Post
Hi all,

I am trying to insert some position management in my strategy, a very simple one actually: I want to add 1 contract to my existing position if the open profit of the existing contract reaches a certain level.
This should be quite easy, but I don't know why this simple instruction is not doing what it should be. I have already checked through the print log that all the condition all TRUE in some candles, but nothing happens:

 
Code
if 	mp=1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then buy("L-Add") 1 contract next bar at open;

if 	mp=-1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then sellshort("S-Add") 1 contract next bar at open;

This is the print log where I print all my adding conditions, as you see there are the 3 candles of 10:00, 11:00 and 12:00 that satisfy the conditions...but nothing happens

 
Code
print(d," ",t," ",mp," ",openpositionprofit," ",OpenEntryContracts);

I also checked the properties of the strategy to see if there was any limitation, but max contract number is actually 65000.


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
eros1973ms
florence
 
Posts: 27 since Oct 2011
Thanks Given: 3
Thanks Received: 6



ABCTG View Post
eros1973ms,

Multicharts requires the user to specifically allow more than one entry in the same direction under the general strategy properties. It will only take one entry by default.
The position limits settings are located on the "Properties" tab of the "Strategy Properties" dialog directly above the "maximum shares/contracts per position" settings that you have already checked.

Regards,

ABCTG

aaah, thanks ABCTG...I knew it was something in the Properties but I didn't see until you told me!!! all good now


Reply With Quote
  #4 (permalink)
 Jerryflyguy 
Moose Jaw Saskatchewan Canada
 
Experience: Advanced
Platform: Qtrader - CQG
Trading: Ag's
Posts: 16 since Oct 2018
Thanks Given: 2
Thanks Received: 9


eros1973ms View Post
Hi all,

I am trying to insert some position management in my strategy, a very simple one actually: I want to add 1 contract to my existing position if the open profit of the existing contract reaches a certain level.
This should be quite easy, but I don't know why this simple instruction is not doing what it should be. I have already checked through the print log that all the condition all TRUE in some candles, but nothing happens:

 
Code
if 	mp=1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then buy("L-Add") 1 contract next bar at open;

if 	mp=-1 
	and OpenEntryContracts=1 
	and openpositionprofit>200 
	and t<1300
	then sellshort("S-Add") 1 contract next bar at open;

This is the print log where I print all my adding conditions, as you see there are the 3 candles of 10:00, 11:00 and 12:00 that satisfy the conditions...but nothing happens

 
Code
print(d," ",t," ",mp," ",openpositionprofit," ",OpenEntryContracts);

I also checked the properties of the strategy to see if there was any limitation, but max contract number is actually 65000.

Could you debug this using a 'paintbar' (put a " * " above the bar or something) for each potential trade? This would give you the positive indication the code is working and it's a platform limitation vs some kind of code issue. My typical go-to for debugging something like this to make the code paint something on the bar to show that the code is right and then move forward w/ trade execution from there, when I can.


Reply With Quote




Last Updated on December 2, 2024


© 2025 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts