Unwanted Trading

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10299 quote
    jbyrne
    Participant
    Average

    Hi, I have written a basic ema cross over system and the system will buy/sell when I don’t want it too and I can’t see whats wrong with my code. Please take a look any help is welcome, thanks. Screenshot of issue: https://gyazo.com/4c337115afa8ec5e7a11c2b030a30ae4

    defparam preloadbars = 15
    defparam CUMULATEORDERS = false
    
    
    indicator1 = ExponentialAverage[20](close)
    indicator2 = ExponentialAverage[50](close)
    
    
    //buy condition
    cBuy = (close CROSSES OVER indicator1)
    
    //sell condition
    cSell = (indicator2 CROSSES Over indicator1)
    
    If cbuy then
    buy 5 perpoint at market
    endif
    
    If csell then
    sell at market
    endif
    
    if csell then
    sellshort 5 perpoint at market
    endif
    
    if cbuy then
    exitshort at market
    endif
    
    #10303 quote
    mr.brymas
    Participant
    Average

    Maybe if you change to:

    //buy condition
    cBuy = (indicator1 CROSSES OVER indicator2)
    
    
    //sell condition
    cSell = (indicator1 CROSSES UNDER indicator2)
    #10304 quote
    jbyrne
    Participant
    Average

    Hi, that then changes the system to something I don’t want but thanks

    #10310 quote
    mr.brymas
    Participant
    Average

    Ok. You can´t use (close) as a parameter

    #10315 quote
    jbyrne
    Participant
    Average

    I think you can, as it seems to recognize it fine.

    #10404 quote
    Derek
    Participant
    Veteran

    Hi jbyrne,

    the trade appears corect to me because “close” crosses under the EMA20 and then crosses over right after the next bar. The system enters the Position when the next bar opens.

    Maybe you can see it more clear when switching from candlesticks to a line. It appears to be a problem with a choppy signal.

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

Unwanted Trading


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jbyrne @jbyrne Participant
Summary

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

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