Can someone explain what this strategy is doing?
Announcement
Collapse
No announcement yet.
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(); } }
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment