![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
Hi ,
I am wanting to change my trade size on some trades and am using a bool set to false. Hasve searched the forum but still unsure why it wont change as shown. Tradesize =20000 for the entry. thanks Raef ![]() // Condition set 1 if (SecondEntry == true) { Tradesize = 20000; // problem here } if (CrossAbove(EMA(Fema), EMA(Sema), 1)) { EnterLong(Tradesize, ""); } |
|
|
|
|
|
#2 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
raefon,
If you could post more of your code it would be helpful. I don't see anything immediately wrong with this. I look forward to assisting you.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#4 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
This forum has me limited to 10000 and wont let me post the whole script so attached as zip file
raef privatebool secondEntry = false; // Default setting for SecondEntry privateint tradesize = 10000; // Default setting for Tradesize // User defined variables (add any user defined variables below) #endregion [Description("")] [GridCategory("Parameters")] publicbool SecondEntry { get { return secondEntry; } set { secondEntry = value; } } [Description("")] [GridCategory("Parameters")] publicint Tradesize { get { return tradesize; } set { tradesize = Math.Max(10000, value); } } #endregion |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
raefon,
You aren't setting the SecondEntry property to true so it won't ever change the order quantity. Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#6 |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,184
Thanks: 178
Thanked 301 times in 259 posts
|
|
|
|
|
|
The following user says thank you to sledge for this post: |
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
sledge,
He has "SecondEntry" setup as a user defined input but it is never changing. My impression was he wants to increase his order size after something occurs. Since nothing is setting the parameter "SecondEntry" the order quantity never changes. It will always either be 10000 or 20000 depending on what he sets the "SecondEntry" to initially. Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
Hi Adam,
I am not sure what you mean. privatebool secondEntry = false; // Default setting for SecondEntry Its a bool at the begining of the script and can be set to true in the variables but it's default is false. // Condition set 1 if (SecondEntry == true) { Tradesize = 20000; } if (CrossAbove(EMA(Fema), EMA(Sema), 1)) { EnterLong(Tradesize, ""); }
Last edited by raefon72; 01-02-2012 at 03:15 PM.
|
|
|
|
|
|
#9 | |
|
Senior Member
|
Quote:
Where in your code have you set SecondEntry to true, based on some condition or other? If you have not explicitly set SecondEntry to true somewhere in the code, then it has its default value, which is false, so your test condition above will never trigger. |
|
|
|
|
|
|
#10 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
At the parameter settings I can select true or false. The strategy works as false and works as true but doesn't change my entry size. It seems to ignore the statement.
|
|
|
|
|
|
#11 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,184
Thanks: 178
Thanked 301 times in 259 posts
|
Quote:
It isn't being accepted as a parameter for whatever reason. I have not dealt with these as I don't use parameters, but please try this instead: privatebool secondEntry ; // Default setting for SecondEntry |
|
|
|
|
|
|
#12 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
Thanks guys,
There must be somthing else wrong however i have copied the code and put it into a strategy and it seems to work ok on another strategy. There might be somthing missing on this one. One job down and only a few to go. ![]() ![]() Thanks again. |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,184
Thanks: 178
Thanked 301 times in 259 posts
|
Sometimes, restarting NT clears up a lot of these odd items that work elsewhere.
Good luck! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| int to int comparison for optimization | dirygoatee | Strategy Development | 1 | 11-22-2011 01:04 PM |
| Changing order type without changing IOrder name | guillembm | Miscellaneous Support | 1 | 11-07-2011 09:23 AM |
| ExitLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double s | adamus | Version 7 Beta General Questions & Bug Reports | 9 | 06-28-2010 04:16 PM |
| Double into int | Gepetto | Automated Trading | 5 | 11-18-2009 11:16 AM |
| double to int ? | zoltran | Indicator Development | 3 | 03-14-2007 01:51 AM |