Crossing moving avereges

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #220674 quote
    Bryggare
    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_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
    Bryggare
    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.

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 Bryggare
2 years, 5 months ago.

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