Crossing moving avereges

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #220674 quote
    BryggareBryggare
    Participant
    Average

    Hi! I wonder if you could help me with the code for en indicator.

    I would like an indicator that meets the following conditions

    1 .  An 8 day exponential moving average crossing a 30 day exponential moving average

    1. The condition in point one shall be compared with the same condition last time it happened back in time.

    If you compare the current crossing of the average, with the crossing of  the average the time before,  then the current close on price must be at least 0.5% higher.

    If so, the indicator should show a 1, otherwise a 0

    Would be thankful for help

    #220675 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Hi,

    ema8=ExponentialAverage[8](close)
    ema30=ExponentialAverage[30](close)
    signal=0
    if ema8 crosses over ema30 then
    prevcross=latestcross
    latestcross=close
    signal= latestcross/prevcross>=1.005
    endif
    
    return signal
    #220681 quote
    BryggareBryggare
    Participant
    Average

    Woow, that was fast done. It seems to work perfect. thank you very much for the help.

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

Crossing moving avereges


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bryggare @bryggare Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/11/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...