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
SetStopLoss doesn't work with "fromEntrySignal"
Collapse
X
-
SetStopLoss doesn't work with "fromEntrySignal"
Hello, if I use SetStopLoss only with two parameters (CalculationMode mode, double value) it woks correctly. But if I use SetStopLoss with four parameters (fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop) the stop order is fixed in a incorrect level. I have made a lot of tests checking this issue. How can I solve it? Thanks in advance.Tags: None
-
Hello Paul,
Thank you for your help. This mi code:
a) SetStopLoss(EtiquetaEntradaCorta, CalculationMode.Ticks, Ticks_StopMax, false);
b) SetStopLoss(CalculationMode.Ticks, Ticks_StopMax);
The variable "EtiquetaEntradaCorta" is a string with the name of the strategy and the currentbar.
The variable "Ticks_StopMax" is a double.
Comment
-
Hello Paul,
The issue continues. I attach a sample. When I use "SetStopLoss" without fromEntrySignal name, it works ok. But when I use the parameter "fromEntrySignal name" it doesn' work.
Thanks in advance for your help.
Attached Files
Comment
-
Hello soyjesus,
Thanks for your reply.
In your example, you are already assigning a setstoploss order in the same block where you are placing the enter long order. Later you are trying to add another setstoploss with the order name but this will not work because the first setstoploss is in place and only one stoploss per order is possible.
Here is an example of how you use signal names:
if (EntryConditions are true)
{
SetStopLoss ("MySignalName", CalculationMode.Ticks, 20, false); // always set the stop/profit values first to ensure they are ready
SetProfitTarget("MySignalName", CalculationMode.Ticks, 20);
EnterLong("MySignalName");
}
if (conditions to adjust the stoploss)
{
SetStopLoss("MySignalName", CalculationMode.Price, Low[0] - 5 * TickSize, false);
}
Paul H.NinjaTrader Customer Service
Comment
-
Hello soyjesus,
Thanks for your reply.
The example I showed in Post #8 starts with a stop loss at 20 ticks from the entry. Then I adjust the stop loss (when "conditions to adjust the stoploss" becomes true) to a price based value of the Low[0] price - 5 ticks.
Paul H.NinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
63 views
0 likes
|
Last Post Today, 06:25 AM | ||
Started by volIQ, 03-27-2024, 04:28 PM
|
3 responses
21 views
0 likes
|
Last Post
by RJay
Today, 05:41 AM
|
||
Started by Nickgiaco, 02-26-2024, 10:23 AM
|
2 responses
72 views
0 likes
|
Last Post Today, 05:12 AM | ||
Started by Johndc, Today, 04:39 AM
|
0 responses
8 views
0 likes
|
Last Post
by Johndc
Today, 04:39 AM
|
||
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
11 views
0 likes
|
Last Post Today, 02:34 AM |
Comment