protected override void Initialize()
{
Add("^SP500", PeriodType.Day, 1);
SetStopLoss("", CalculationMode.Percent, 10, false);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (IsIndexCloseHigherThenAverageIndexClose &&
IsHighHigherThenAverageClose &&
IsHighHigherThenHighestHigh)
EnterLong();
if (IsLowLowerThenLowestLow)
ExitLong();
}
private bool IsIndexCloseHigherThenAverageIndexClose
{
get
{
return Closes[1][0] > SMA(BarsArray[1], 200).Close[0];
}
}
private bool IsHighHigherThenAverageClose
{
get
{
return High[0] > SMA(High, 200)[0];
}
}
private bool IsHighHigherThenHighestHigh
{
get
{
return High[0] > MAX(High, 50)[1];
}
}
private bool IsLowLowerThenLowestLow
{
get
{
return Low[0] < MIN(Low, 20)[1];
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding to a long position?
Collapse
X
-
Adding to a long position?
Let say I use this strategy to enter a long position:
But now after I have enter a long position I wanna add more to the long position when its go up 5% of the initial long position and I wanna do this 5 times. How can I do it?Code:Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
28 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
183 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
336 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
261 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment