Request coding for candles high / low in trend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #177843 quote
    phoentzsphoentzs
    Participant
    Master

    Hi there,
    I need a code for an indicator that shows the following rules. At best as a line similar to a Donchian?

    The following rules:

    H4 timeframe

    Bullish:
    EMA50> EMA50 [1]
    Red candle (open> close)
    Lowest high of the last RED CANDLE [5]

    Bearish:
    EMA50 <EMA50 [1]
    Green candle (close> open)
    highest low of the last GREEN CANDLE [5]

    In addition, only those candles of the respective color that are in line with the trend of the EMA specification are taken into account.

    The aim is to get a stop order at the respective point (high / low) as an entry condition for a trading system.
    It is important that only candles of the respective direction / color are taken into account and that the entry point is then determined.

    #177844 quote
    phoentzsphoentzs
    Participant
    Master

    Here is an instructional video of the original version of Long Hang Seng. I just added some rules of my own. Maybe you can also code the original setup to see which system is better? So two versions?

    Short:

    Long:

    #177852 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Please:

    • post your rules in details explaining what to do with it (Lowest high of the last RED CANDLE [5] isn’t clear)
    • on which candle do you want the signal to be generated?
    #177855 quote
    phoentzsphoentzs
    Participant
    Master

    Hang Seng’s original setup should explain the videos well.

    My setup in short:

    Long: EMA50 rises, stop buy order at the high of the lowest high of the last 5 RED candles.

    Short: EMA50 goes down, stop sell short order at the low of the highest low of the last 5 GREEN candles.

     

    Attached as a picture. Sorry for the quality. Created on the smartphone.

    EA9239C1-8EAE-4049-8463-C9B6AE510502.jpeg EA9239C1-8EAE-4049-8463-C9B6AE510502.jpeg F538567A-28FA-4099-AACE-D0DF2875A403.jpeg F538567A-28FA-4099-AACE-D0DF2875A403.jpeg
    #177862 quote
    phoentzsphoentzs
    Participant
    Master

    EurUsd short signals last week as a picture.

    6167EB45-C3FA-4C19-8D82-CD26F26251E7.jpeg 6167EB45-C3FA-4C19-8D82-CD26F26251E7.jpeg
    #177900 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There  you go:

    Offset  = average[100,0](range)
    Ema50   = Average[50,1](close)
    EmaUP   = Ema50 > Ema50[1]
    EmaDN   = Ema50 < Ema50[1]
    Bullish = close > open
    Bearish = close < open
    Bulls   = 0
    Bears   = 0
    hh      = 9999999
    ll      = 0
    FOR i = 0 TO BarIndex
       IF Bullish[i] AND (Bulls < 5) THEN
          Bulls = Bulls + 1
          ll    = max(ll,low[i])
       ENDIF
       IF Bearish[i] AND (Bears < 5) THEN
          Bears = Bears + 1
          hh    = min(hh,high[i])
       ENDIF
       IF (Bulls >= 5) AND (Bears >= 5) THEN
          Break
       ENDIF
    NEXT
    IF Bullish AND EmaUP THEN
       IF close CROSSES OVER ll THEN
          DrawArrowUP(BarIndex,low - Offset) coloured(0,128,0,150)
       ENDIF
    ENDIF
    IF Bearish AND EmaDN THEN
       IF close CROSSES UNDER hh THEN
          DrawArrowDOWN(BarIndex,high + Offset) coloured(255,0,0,255)
       ENDIF
    ENDIF
    RETURN hh coloured(255,0,0,255) style(line,2) AS "SHORT entry",ll coloured(0,128,0,140) style(line,2) AS "LONG entry"
    phoentzs thanked this post
    x-11.jpg x-11.jpg
Viewing 6 posts - 1 through 6 (of 6 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

Request coding for candles high / low in trend


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
5 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/18/2021
Status: Active
Attachments: 4 files
ProRealCode ProRealCode
Loading...