SMA and bull candle condition not working

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #161441 quote
    kevin12345kevin12345
    Participant
    Average

    hi,

    i want to go long when a bull candle is over the 20ma. the codes i got for it is

    ma20 = Average[20](close) //set ma20 as the 20 simple moving average
    bullcandle = (close > open) //bull candle
    c1 = (open >= ma20) AND bullcandle
    IF c1 then
    BUY 1 CONTRACT AT MARKET
    ENDIF

    some candles done on the backtest satisfy what i was coding it for but some do not. like the one on the picture. can anyone explain what i am doing wrong and how can i improve thanks.

    #161445 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There’s no pic attached ti your post.

    At first glance your code seems correct.

    #161454 quote
    VonasiVonasi
    Moderator
    Master

    kevin12345  – Please try to give your topics more meaningful titles. I have changed the title of your topic to something more descriptive.

    #161461 quote
    kevin12345kevin12345
    Participant
    Average

    how do i submit a picture? isnt it select file under attachment?

    #161462 quote
    kevin12345kevin12345
    Participant
    Average
    #161467 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It’s working fine on Dax, 15-minute TF.

    Post instrument/asset, TF, date and time where there’s a wrong entry, so I can replicate it.

    #161468 quote
    kevin12345kevin12345
    Participant
    Average

    it seems like its working now when i checked again. i don’t know what happen but thank you for reply.

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

SMA and bull candle condition not working


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kevin12345 @kevin12345 Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by kevin12345kevin12345
5 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/15/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...