• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Finding value at which lines cross

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

    Finding value at which lines cross

    Hello,
    I'd like to find the value at which 2 SMA's cross. Can someone help me with this?
    Thanks.

    #2
    Hello CaptainAmericaXX,

    Thanks for your post.

    Here is an example using two SMAs:

    if (CrossAbove(SMA(10), SMA(30), 1))
    {
    Print ("CrossAbove levels: "+SMA(10)[0]+" "+SMA(30)[0]);
    }

    Note that the levels of the SMAs in this example would rarely ever be the same because the values are based on a data point of the bar. To better visualize this, change both of the moving average plot styles from line to cross. The center of the cross shows the actual data point of the moving average plot. I've attached a screenshot showing the moving averages plotted as normal Line type and then as crosses.
    Attached Files
    PaulNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by enzo_, Today, 05:07 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Trader17, Today, 02:05 PM
    3 responses
    12 views
    0 likes
    Last Post i2w8am9ii2  
    Started by gbux11, Today, 05:11 PM
    0 responses
    2 views
    0 likes
    Last Post gbux11
    by gbux11
     
    Started by istock999, Today, 04:30 PM
    0 responses
    2 views
    0 likes
    Last Post istock999  
    Started by jmneto, Today, 04:16 PM
    0 responses
    0 views
    0 likes
    Last Post jmneto
    by jmneto
     
    Working...
    X