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

Modify existing Long Short strategy

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

    Modify existing Long Short strategy

    I wonder if someone could please modify this strategy from the Strategy section here ?

    The change I am requesting is :

    If long entry button activated, enter long if current bar closes up (preferably Limit order at bar close price).
    If short entry button activated, enter short if current bar closes down (preferably Limit order at bar close price).


    Trade is then managed by ATM (if selected).

    I am using range bars, so the bar will close either at its high or low. It would be very helpful, although not essential, if the strategy would default to "Inactive" if the signal did not fire on the first bar after activation.
    Attached Files

    #2
    Hello jtrade,

    Thank you for your post.

    We can provide support on building this strategy but we do not provide programming services.

    In the code for the strategy you will notice two ToolStripButtons, btnManual and btnEntry. btnManual for Long entries and btnEntry for short entries.
    If you follow these you will notice the following conditions:
    Code:
    if (btnManual.Text != "LONG"
    	&&
    	Close[1]>=MAX(High,2)[2]+0*TickSize
    				&&High[1]<CurrentDayOHL().CurrentHigh[1]
    	&&High[0]>High[1]
    //0>SMA(5)[1]-SMA(34)[1]
    //	&&(
    //
    //	(0<SMA(5)[0]-SMA(34)[0])
    //	)
    	)
    {
    
    EnterLong();
    }
    if (btnEntry.Text != "SHORT"
    	&&	Low[1]>CurrentDayOHL().CurrentLow[1]
    	&&Low[0]<Low[1]
    	&&
    Close[1]<MIN(Low,2)[2]-0*TickSize
    //	0<SMA(5)[1]-SMA(34)[1]
    //	&&(
    //
    //	(0>SMA(5)[0]-SMA(34)[0])
    //	)
    	)
    
    {
    EnterShort();
    }
    You can replace EnterLong() and EnterShort() with the AtmStrategyCreate() method. However, there is more to the ATM Strategy Methods and I would recommend reviewing the information at the following link: http://www.ninjatrader.com/support/h...gy_methods.htm

    As well, I would recommend reviewing the SampleAtmStrategyReversal strategy I created at the following link for an example on how to properly reverse the position with ATM Strategy Methods: http://www.ninjatrader.com/support/f...d=5&linkid=615

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank-you, Patrick..... but like I always say, trading is hard enough without trying to become a programmer...

      Comment


        #4
        Hello jtrade,

        Thank you for your response.

        The NinjaTrader Ecosystem partners with a number of programming consultants that offer custom coding for the NinjaTrader environment.

        Below is a link to these Certified NinjaScript Consultants. You may hover your mouse over each one for a short description.
        http://ninjatraderecosystem.com/Part...ultants.php#81

        Once you have reviewed these consultants, should you have any questions or desire an introduction please let me know and I will be happy to assist.
        JaredNinjaTrader Ecosystem

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 12:39 AM
        0 responses
        2 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by tonynt, 05-21-2019, 06:27 AM
        11 responses
        534 views
        1 like
        Last Post NinjaTrader_Jason  
        Started by fitspressotablettry, Today, 12:36 AM
        0 responses
        1 view
        0 likes
        Last Post fitspressotablettry  
        Started by Lancer, 01-29-2020, 10:15 PM
        7 responses
        468 views
        1 like
        Last Post NinjaTrader_Jason  
        Started by gravdigaz6, Today, 12:05 AM
        0 responses
        1 view
        0 likes
        Last Post gravdigaz6  
        Working...
        X