Can someone explain what this strategy is doing?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
SampleTradeObjects Question
Collapse
X
-
SampleTradeObjects Question
I'm trying to understand the Trade Class usage and in doing so I've tried using the Reference Sample titled "SampleTradeObjects" but it doesn't seem to do what I believe it is supposed to...or perhaps I need further explaining. My understanding is 'lastThreeTrades' is suppossed to increase or decrease by one, depending on a winner or looser respectively. However, when running the strategy, it often trades 4 contracts, sometimes one contract for four times in a row before increasing, etc. Therefore, I've inserted some Print statements to understand what values were being provided for 'lastThreeTrades' and also what value is given for 'lastThreeTrades++' and 'lastThreeTrades--'
Can someone explain what this strategy is doing?Tags: None
-
Tdschulz, I'm not sure where your cs file is taken from but the original example is found here - http://www.ninjatrader.com/support/f...ad.php?t=19289
It would stop trading for the day if you had seen 3 losing trades in a row (reset for each session).
Code:/* If lastThreeTrades = -3, that means the last three trades were all losing trades, don't take anymore trades if this is the case. This counter resets every new session, so it only stops trading for the current day. */ if (lastThreeTrades != -3) { if (Position.MarketPosition == MarketPosition.Flat) { // If a new low is made, enter short if (CurrentDayOHL().CurrentLow[0] < CurrentDayOHL().CurrentLow[1]) EnterShort(); // If a new high is made, enter long else if (CurrentDayOHL().CurrentHigh[0] > CurrentDayOHL().CurrentHigh[1]) EnterLong(); } }
BertrandNinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by sofortune, Yesterday, 11:48 AM
|
2 responses
22 views
0 likes
|
Last Post Today, 07:11 PM | ||
Started by Zach55, 02-19-2024, 07:22 PM
|
2 responses
53 views
0 likes
|
Last Post
by lbadisa1
Today, 07:06 PM
|
||
Started by JGriff5646, Today, 05:47 PM
|
1 response
9 views
0 likes
|
Last Post Today, 06:45 PM | ||
Started by AlphaOptions, 06-18-2013, 08:24 AM
|
9 responses
2,200 views
0 likes
|
Last Post Today, 06:36 PM | ||
Started by ttrader23, Today, 09:33 AM
|
3 responses
23 views
0 likes
|
Last Post Today, 06:28 PM |
Comment