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!
See more
See less

Partner 728x90

Collapse

SetStopLoss doesn't work with "fromEntrySignal"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_PaulH
    replied
    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.





    Leave a comment:


  • soyjesus
    replied
    Ok, but I need to change the level of stop-loss when the price reach a level. So I need to begin with a level stop and after to change this level. How can I do it?

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    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);
    }

    Leave a comment:


  • soyjesus
    replied
    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

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello soyjesus,

    Thanks for your reply.

    From your original description, I suspect the issue is related to the string name used so you may want to verify the entry order name exactly matches the entry name used in the SetStopLoss.


    Leave a comment:


  • soyjesus
    replied
    Thanks for your reply. I'm trying to find the issue with a new code more simplificated.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello soyjesus,

    Thanks for your reply.

    I am asking for a working strategy that has only the code used to demonstrate the issue and the steps to recreate the issue (Instrument, bar type, time frame, Live/replay/strategy analyzer).

    Thanks in advance.

    Leave a comment:


  • soyjesus
    replied
    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.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello soyjesus,

    Thanks for your post.

    Please provide a reduced example script and the steps to replicate, that demonstrates the issue you are observing.

    Leave a comment:


  • soyjesus
    started a topic SetStopLoss doesn't work with "fromEntrySignal"

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Angus7, Today, 06:03 AM
0 responses
2 views
0 likes
Last Post Angus7
by Angus7
 
Started by Rhoamajhunm, Today, 05:15 AM
0 responses
4 views
0 likes
Last Post Rhoamajhunm  
Started by cannaleafzcoast, Yesterday, 11:46 PM
0 responses
18 views
0 likes
Last Post cannaleafzcoast  
Started by BiankaRidge, Yesterday, 11:37 PM
0 responses
21 views
0 likes
Last Post BiankaRidge  
Started by RodBlanda, Yesterday, 09:58 PM
0 responses
19 views
0 likes
Last Post RodBlanda  
Working...
X