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

Streak and Stop Loss

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

  • NinjaTrader_Emily
    replied
    Hello donwynne,

    Thank you for your note.

    For users newer to NinjaScript or trying to learn NinjaScript, I always recommend checking out this post written by my colleague for some helpful information and resources:



    As this post is over 2 years old, I am not sure if the original poster would still have the code to share. If you have a specific question or something you are trying to achieve via NinjaScript, we would be glad to share a snippet or example as well as some resources to help you with writing the script.

    Please let us know if we may be of further assistance.

    Leave a comment:


  • donwynne
    replied
    My programming knowledge is not very good, I used to learn php, I just came into contact with this, can you post your code?






    ​I am a programmer, good at programming, web design, software development
    Last edited by donwynne; 09-12-2022, 09:32 PM.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello Carlos,

    Thanks for your post.

    I do not think that you can accomplish your first objective within the strategy builder but would suggest that this would involve at best an elaborate use of bool variables to control the sequencing. They key objective of "if Streak Variable = 1 it does not place an order but if It would do it the trade end as a winner and it makes the Streak Variable = 0" would likely be the stumbling block as you would have to guess at the entry/exit and/or perform math on variables which is not available in the strategy builder.

    For #2, you would not be able to set this automatically in the strategy builder as the account value is not available.

    Please note that we do not provide programming services. We can leave this thread open for others in the community that may wish to provide this level of assistance.

    Alternatively, you may want to hire a 3rd party programmer who would be able to create a strategy to meet your needs (although not in strategy builder form). If this is of interest we can provide a link to a developers site in the Ninjatrader ecosystem.

    Leave a comment:


  • Cyanez
    started a topic Streak and Stop Loss

    Streak and Stop Loss

    Good Morning,

    I'm trying to break losing streak in my strategy.

    I'm using the strategy builder as my programming knowledge are not good enough to do it.

    I would like your help with the following:

    1) I would like to add a condition using a variable that is 0 if the previous trade was a winner and 1 is it was a loser. If the Streak Variable = 0 it places an order, if Streak Variable = 1 it does not place an order but if It would do it the trade end as a winner and it makes the Streak Variable = 0 and it will be taken the next trade.
    I'm struggling to get it to work. I need the condition to make the variable 0 or 1, also I need this variable to change to 0 even when it does not take the trade.
    Can you please tell me how to do it?

    2) Also, I'm trying to set a stop loss that is a % of my current account value. For example, Stop loss = 3% of Account Value.

    Thank you in advance for all your help.
    Regards
    Carlos

Latest Posts

Collapse

Topics Statistics Last Post
Started by Kaledus, Today, 01:29 PM
0 responses
3 views
0 likes
Last Post Kaledus
by Kaledus
 
Started by PaulMohn, Today, 12:36 PM
1 response
16 views
0 likes
Last Post NinjaTrader_Gaby  
Started by yertle, Yesterday, 08:38 AM
8 responses
37 views
0 likes
Last Post ryjoga
by ryjoga
 
Started by rdtdale, Today, 01:02 PM
1 response
6 views
0 likes
Last Post NinjaTrader_LuisH  
Started by alifarahani, Today, 09:40 AM
3 responses
19 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X