I attached a sample code. Could you please have a look at it and tell what is wrong with it? Thanks a lot!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Break Even
Collapse
X
-
Hello moon_121,
Thank you for your post.
At first glance I do not see any items. Are there any errors in the Log tab of the NinjaTrader Control Center?
Please refer to the following link for methods to debug your NinjaScript code: http://www.ninjatrader.com/support/f...ead.php?t=3418
I look forward to your response.
-
Flat
Hi Patrick,
i find it a bit strange, that my the auto break even seems to draw the strategy performance down instead of lifting it. I get the best performance, if the break even trigger is so far of, that the break even never kicks in.
An if the break even kicks in, the amount of trades more than doubles.
I'm wondering if that has anything to do with the setup of a strategy.
Do I need to create a flat state to level the PnL?
Do I need to define "Open PnL: "
And how do I prevent the strategy to enter again in the position that was stopped by a break even one bar ago?
Code:// Beginning of Auto-Break-Even // If not flat print our unrealized PnL if (Position.MarketPosition != MarketPosition.Flat) Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points)); if (Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > trigger * TickSize) { SetStopLoss(CalculationMode.Price, Position.AvgPrice + 1 * TickSize); } // Ende of Auto-Break-Even
Comment
-
Originally posted by moon_121 View PostHi Patrick,
i find it a bit strange, that my the auto break even seems to draw the strategy performance down instead of lifting it. I get the best performance, if the break even trigger is so far of, that the break even never kicks in.
An if the break even kicks in, the amount of trades more than doubles.
I'm wondering if that has anything to do with the setup of a strategy.
Do I need to create a flat state to level the PnL?
Do I need to define "Open PnL: "
And how do I prevent the strategy to enter again in the position that was stopped by a break even one bar ago?
Code:// Beginning of Auto-Break-Even // If not flat print our unrealized PnL if (Position.MarketPosition != MarketPosition.Flat) Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points)); if (Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > trigger * TickSize) { SetStopLoss(CalculationMode.Price, Position.AvgPrice + 1 * TickSize); } // Ende of Auto-Break-Even
Last edited by koganam; 01-11-2013, 11:57 AM.
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment