find high of candle after crossing moving average

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #187707 quote
    MishapMishap
    Participant
    Junior

    Hi,

    I know this sounds simple but what i am trying to achieve is to get the high of the first candle that crosses a moving average while monitoring price doesn’t go below a second moving average.

    essentially i want to create a stop order at high of candle crossing moving average but cancels if price goes below second moving average.

    snippet below of what i tried. not sure im on the right path though.

    thanks for any help in advance

    if low crosses under EMA1 then
     entry = high
    signal = 1
    endif
     
    if signal = 1 and close>EMA2 then
    BUY 1 Contracts at signal STOP
    endif
    
    #187709 quote
    MishapMishap
    Participant
    Junior

    apologies second if should read as below

    if signal = 1 and close>EMA2 then
    BUY 1 Contracts at entry STOP
    endif
    #187772 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    That’s correct.

    I suggest to add these lines BEFORE your above lines:

    IF OnMarket THEN
       Signal = 0
    ENDIF
    Mishap thanked this post
    #187848 quote
    MishapMishap
    Participant
    Junior

    thanks roberto šŸ™‚

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

find high of candle after crossing moving average


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mishap @mishap Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by MishapMishap
4 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/07/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...