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

script not responding as expected

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

    script not responding as expected

    Hi,
    Tried to develop a simple strategy where if a determined EMA crosses over the middle line of bollinger it opens long and closes it if the price is same or bigger than top band of bollinger or the same EMA crosses bellow the middle bollinger again. The long is only opened if the crossing is above the 200 EMA.
    When activating the strategy on a sim account, the plot shows that the position is not getting exited on the cross bellow. Why would that be happening?

    Click image for larger version

Name:	Captura de Ecrã (4).png
Views:	196
Size:	805.7 KB
ID:	1129832
    Not closing when crossing bellow. (for ilustration reasons i took the condition to close if it touches top bollinger). It basically opens the position and takes it to the EOD.

    Click image for larger version  Name:	Captura de Ecrã (3).png Views:	0 Size:	365.1 KB ID:	1129828Click image for larger version  Name:	Captura de Ecrã (2).png Views:	0 Size:	357.5 KB ID:	1129829

    Afrer that I will create a condition group for it not to close for a variable number of bars.
    Also, sometimes the entry is one bar too late, any way to speed it up to the first bar immediately after crossing ? Tried calculating on price and tick changes.
    Attached Files
    Last edited by Sifred; 11-28-2020, 11:57 AM.

    #2
    Hello Sifred,

    Print the values used in the conditions along with the time of the bar to understand when and why a condition is true or false.
    Below is a link to a forum post that demonstrates using prints to understand behavior. Please watch the video 'Debugging using prints with the Strategy Builder'.


    I am happy to assist with analyzing the output from prints.

    In real-time using Calculate.OnPriceChange or Calculate.OnEachTick will drive events intra-bar. In historical data, intra-bar granularity or TickReplay is required to drive intra-bar events.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    41 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    21 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X