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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
639 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 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
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
572 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment