find high of candle after crossing moving average

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #187707 quote
    Mishap
    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
    Mishap
    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
    robertogozzi
    Moderator
    Master

    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
    Mishap
    Participant
    Junior

    thanks roberto 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

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 Mishap
4 years ago.

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