Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit target function

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

    Profit target function

    Hello,
    I have a problem with profit targets. I want the contract to close when it reaches the obtained target. But I do not want an automated order to be entered unless the strategy signals for it according to its original settings. What happens now is that the automated system buys or sells again, without waiting for the original signal of the strategy.
    So what I need is:
    • an original strategy signal i.e. at crossing SMA 1000
    • target price 200 pips
    • exit and wait for the next original strategy signal at crossing SMA 1000 again


    In the picture you see that the system enters short at the immediately next step, which is something that I don’t want.

    I would appreciate any possible help.
    Thank you.
    Attached Files

    #2
    Hello,

    Thank you for your note.

    The reason this occurs most likely is your EnterShort() or EnterLong() logic is still true thus it is still being called. Since Entries Per Direction is set to 1, as soon as you exit the 1 long position this allows the EnterLong()/Short() to execute again since the position is flat.

    To resolve this you would need to also have a flag, that you need to only call EnterLong() when this flag is set to true. Then when you EnterLong() set this flag to false. Therefor EnterLong will no longer be called continually. Also, you would need to set this flag back to True when your entry cinditions are valid again.

    Let me know if I can be of further assistance.

    Comment


      #3
      Brett, thank you for your answer,

      I understand from your answer that it is possible to achieve what I need. But I don’t understand exactly how to create the necessary conditions in Ninja and most importantly how to set the conditions for automated trading. Can you please give a step by step example?
      Thanks

      Comment


        #4
        giorgos, while we could not custom code this for you, the bool programming concept Brett brought up would work like the below -

        if (ConditionA and myBool)
        EnterLong()
        myBool = false;

        if (Condition B)
        myBool = true;
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        41 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        11 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        1 view
        0 likes
        Last Post port119
        by port119
         
        Started by Philippe56140, Today, 02:35 PM
        0 responses
        3 views
        0 likes
        Last Post Philippe56140  
        Started by 00nevest, Today, 02:27 PM
        0 responses
        2 views
        0 likes
        Last Post 00nevest  
        Working...
        X