Heikin ashi green/red indicator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120864 quote
    umebon
    Participant
    Average

    Hi

    How can I program this Heiki-indicator so I get a value that I can call for like I did in this code (https://www.prorealcode.com/topic/calling-indicator/) where it returns values? I want one value or  when it goes red and one value when it turns green.

    Found this screener from Nicolas (https://www.prorealcode.com/prorealtime-market-screeners/bullish-and-bearish-heiken-ashi-screener/) but can’t figure out how to get values that i can use in a system.

     

    xClose = (Open+High+Low+Close)/4
     
    if(barindex>2) then
      xOpen = (xOpen[1] + xClose[1])/2
    endif
     
    c1 = xClose>xOpen AND xClose[1]<xOpen[1]
    c2 = xClose<xOpen AND xClose[1]>xOpen[1]
     
    SCREENER [c1 OR c2]
    #120872 quote
    Vonasi
    Moderator
    Master

    Perhaps you mean something like this?

    xClose = (Open+High+Low+Close)/4
     
    if(barindex>2) then
      xOpen = (xOpen[1] + xClose[1])/2
    endif
     
    c1 = xClose>xOpen AND xClose[1]<xOpen[1]
    c2 = xClose<xOpen AND xClose[1]>xOpen[1]
    
    result = 0
    
    if c1 then 
    result = 1 
    endif
    
    if c2 then 
    result = -1 
    endif
     
    return result
    umebon thanked this post
    #120882 quote
    umebon
    Participant
    Average

    Thx… I and how do I call it in my system?

    #120906 quote
    Vonasi
    Moderator
    Master

    This should work. Change myIndicator to whatever you have called the indicator.

    result = CALL "myIndicator"[(close)]

    Personally I would just hard code such a simple indicator into my strategy.

Viewing 4 posts - 1 through 4 (of 4 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

Heikin ashi green/red indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/29/2020
Status: Active
Attachments: No files
Logo Logo
Loading...