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

WMA Slope indicator Strategy error

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

    WMA Slope indicator Strategy error

    Dear Sir or Madam,

    With reference to the Data attached with this mail, I want to inform you that I was not able to overcome a problem I faced after coding the strategy using NT7 ATM (indicator & 2 Strategies I coded & Screenshots are attached)
    Description:
    If you run the indicator you will notice that it is a simple WMA one with green and red plots:
    I want to go long when it plots green and go short when it plots red and cancel/close all the order when it is flat.
    Actually you will notice that I open 3 different orders with different target profits in each trade executed.

    The problem:
    I think I wrote the code with the right conditions, somehow I found that:
    -It executes trades in the wrong locations. Example (Executes Long position in clearly Red plot locations)
    - Executes “Buy to cover”. I do not want the platform executing trades I do not wish to.


    Request:
    Please can you help me to understand what I missed here. And how can I come over it.
    The objective is I wish to have a simple strategy that is able to execute this:
    - Entry long when it plots green in both conditions (slope up or WMA up)

    - Entry short when it plots Red< (slope down or WMA down)
    - Exit all trades when the indicator showing flat.



    Is there any possibility to help me with the subject please.



    Thank you

    Yassine
    Attached Files

    #2
    Hello Yassine,

    A Buy to cover order is an exit order for a short position. If there are any short positions open and the short position is exited, this will be exited with a Buy to cover order.

    To understand why the script is behaving as it is, either placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints that print the values of every variable used in every condition that places an order along with the time of that bar.

    This will print to the output window. Backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output from both computers to your reply.

    Below I am providing a link to videos that demonstrate adding prints to a script to get further information about the behavior of the script.

    NT8 — http://www.screencast.com/t/TvUGSvfxdXt

    NT7 — https://www.youtube.com/watch?v=K8v_...tu.be&t=48m35s

    Please add prints to your script and send the output from the script and I will assist in analyzing this output to understand the behavior.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    5 responses
    551 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rtwave, 04-12-2024, 09:30 AM
    5 responses
    37 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by funk10101, Today, 12:02 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by nandhumca, Yesterday, 03:41 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X