How do you program a shift to the left

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7391 quote
    prs010
    Participant
    New

    Hi,

    I’d like to shift my plot to the left like you can do with the built in moving averages by using a negative “Horizontal shift” value when you add the moving average.

    I can’t figure out how to do this in programming.

    Any ideas?

    #7402 quote
    Adolfo
    Participant
    Senior

    Hi, if you mean future price, right click on main chart, choose “chart properties” and change default value of 3% to your desired (See image below)

    #7408 quote
    prs010
    Participant
    New

    Thats good to know but its not what I’m trying to do.  I want the indicator that I program to be shifted to the left relative to the price. If you look at my example the moving average is shifted to the left by 20 bars.

    I get an error saying I must use a positive integer if I program the indicator like this:

    x = average[1](close)[-6]

    return x

     

    How do they program the built in moving average to allow a negative horizontal shift?

    #7412 quote
    Adolfo
    Participant
    Senior

    Nice question, i don’t know…but did you try this?

    x = average[1](close)
    y = x[6]
    #7416 quote
    prs010
    Participant
    New

    That code has the effect of shifting my indicator to the right.  I want to go to the left

    Tradestation allows you to plot back in time by using a plot1[-6] (x)  type statement.

    Is there a similar feature in prorealcode?

    #7422 quote
    Nicolas
    Keymaster
    Master

    Sorry but it is not possible to draw things in the future on chart by code.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

How do you program a shift to the left


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
prs010 @prs010 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Nicolas
9 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/19/2016
Status: Active
Attachments: No files
Logo Logo
Loading...