Difference of last 5 closing

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #97777 quote
    umebonumebon
    Participant
    Average

    Hi

    I wonder how I can code so that I get the difference for the closing price for the 5 last candels in a 5 min chart. Anyone that can help me?

    Ex:

    5 close (1645,3; 1644,4; 1644,1; 1643,8; 1644,6) and I want too have a number for the highest and lowest for the last 5 candles. In this exemple 1645,3-1643,8=1,5

    How can I code it so I get the number 1,5 as output?

    #97779 quote
    VonasiVonasi
    Moderator
    Master
    average[5](close)

    returns the average for the last five candle closing prices – or do you mean that you want the average of the last five 5 minute candles on a different time frame chart?

    umebon thanked this post
    #97780 quote
    umebonumebon
    Participant
    Average

    I have updated my question… i want the difference between highest and lowest close for the 5 last candles

    #97781 quote
    VonasiVonasi
    Moderator
    Master
    a = highest[5](close)
    b = lowest[5](close)
    
    c = (a + b) / 2
    umebon thanked this post
    #97782 quote
    umebonumebon
    Participant
    Average

    Thank you for that… this forum i really great when one is trying too learn!!

    #97783 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    The difference is:

    a = highest[5](close)
    b = lowest[5](close)
    difference = a - b
    umebon thanked this post
    #97784 quote
    VonasiVonasi
    Moderator
    Master

    Roberto’s answer is correct if you want the difference. I may have been confused in my reply as I read your first post and title before you edited them and they originally asked for an average.

    umebon thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Difference of last 5 closing


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by VonasiVonasi
7 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/06/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...