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

flipping trendlines

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

  • NinjaTrader_PatrickH
    replied
    Hello russ123,

    Thank you for your response.

    If it needs to be exact to the distance as viewed on the chart I would move to custom plotting via overriding the Plot() method. We have an example under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

    Leave a comment:


  • russ123
    replied
    hello Patrick,

    I dont think it can be done like this because x2 - x1 will give the number of bars across the x axis,not the actual distance in cm or inches.

    for example, If the number of bars is 10 and i substitute this for the Y2 parameter, it will not work because adding 10 to a contract like the yen or the euro will be way too much. Even if i multiply it by the tick size, it will be inaccurate.

    The only way to do this is by capturing the distance/length in cm or inches and then using that distance/length to get Y2.

    other ideas that come to mind are
    1) changing the slope to 90 degrees
    2) see if it Is possible to draw a big square instead by just giving the parameters for the length of the square. One side is all you need for a square. Maybe there is a method to do this ?

    let me know if you have any more input

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello Rassul,

    Thank you for your response.

    I would store the difference of the X1 and X2 in a double and then use it for the Y2 when switching to the vertical line.

    Leave a comment:


  • russ123
    replied
    hello,

    I am using the drawlinefunction within ninjascript which basically takes the X1 X2 and the Y1 Y2 coordinates. I am specifying the X1 Y1 and X2 Y2 coordinates to draw a horizontal trendline.

    Now I need to create a VERTICAL trendline of the same length. The X1 and X2 coordinates are the same and they are known because I specified them for the horizontal trendline. The Y1 coordinate is also known. The problem is the Y2 coordinate for the vertical trendline. The Y2 coordinate is the distance/length of the horizontal line, which is (X2-X1). How can i get this distance and plot it on the Y axis to create a vertical trendline ?

    There maybe another way to do it if there is a method that accepts Slope. If I can specify a slope of 90 degreess for a horizontal trendline, then that line would become a vertical line. I am not sure if there is something like this available ?

    thank you,
    Rassul

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello russ123,

    Thank you for your post.

    Please answer the following questions so we may be of further assistance.

    Leave a comment:


  • russ123
    started a topic flipping trendlines

    flipping trendlines

    Hello

    I want to flip a horizontal trendline to a vertical trendline. Baslically change the slope of the trendline from 0 to 90 degrees up or down. Any ideas on how i can do this in ninjascript?

Latest Posts

Collapse

Topics Statistics Last Post
Started by ezrollin, Yesterday, 10:38 PM
3 responses
7 views
0 likes
Last Post NinjaTrader_PaulH  
Started by janio973, Today, 04:17 AM
0 responses
15 views
0 likes
Last Post janio973  
Started by awa485, Yesterday, 05:08 PM
1 response
10 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by Rafael_OR, Yesterday, 07:04 PM
4 responses
17 views
0 likes
Last Post NinjaTrader_Jim  
Started by lightsun47, Yesterday, 07:17 PM
0 responses
4 views
0 likes
Last Post lightsun47  
Working...
X