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

Help with a Basic Script

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

    Help with a Basic Script

    My code is attached as a text file (ipv10.txt).

    It is quite basic. All it does is enters into a long position and enters a stop loss and profit target for that order. Once that order reaches target or is stopped out, I want to enter a new order at the current market price. I want to keep repeating this until I stop the strategy.

    I noticed 2 problems with this code:

    1. When I load the strategy for the first time on a chart, it immediately enters a long position as it should. But if I ratchet up or down the trend simulator, it never excutes the target profit or stop loss. Why??

    2. If I now stop that strategy and manually close out the long position, and then reload the strategy, it appears to enter a long position as shown by the unrealized profit value that gets updated in real-time (in the strategies tab). But the position tab does not show an open position. What could be happening here?

    Once I shut down Ninja and restart it, open a new chart and load my strategy, a new long position is filled.

    I hope my code gives an easy clue as to these 2 issues.
    Attached Files

    #2
    Sorry, we are unable to provide support at this level. I suggest:
    - try "debugging" by adding Print() statements
    - check out the TradeOrders option
    - you might conseder contacting a NinjaTrader consultant: http://www.ninjatrader.com/webnew/pa...injaScript.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ghoul, Today, 06:02 PM
    0 responses
    4 views
    0 likes
    Last Post ghoul
    by ghoul
     
    Started by Barry Milan, Yesterday, 10:35 PM
    6 responses
    18 views
    0 likes
    Last Post Barry Milan  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    13 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    12 views
    0 likes
    Last Post terofs
    by terofs
     
    Working...
    X