EMA Crossover Strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10170 quote
    stevenug
    Participant
    New

    I am using the code below to test a system for 1Hr Eur/USD and 1 Hr USD/JPY. When I run the optimization with both short and long EMAs set for 1 to 50 in steps of 1 I always get a result where the short EMA has the longest period and vice versa. Why should this be and can it be used as a successful strategy.Thank you

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[short](close)
    indicator2 = ExponentialAverage[long](close)
    c1 = (indicator1 CROSSES OVER indicator2)
    
    IF c1 THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[short](close)
    indicator4 = ExponentialAverage[long](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
    
    IF c2 THEN
    SELL  AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator5 = ExponentialAverage[long](close)
    indicator6 = ExponentialAverage[short](close)
    c3 = (indicator5 CROSSES OVER indicator6)
    
    IF c3 THEN
    SELLSHORT 1 PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    indicator7 = ExponentialAverage[long](close)
    indicator8 = ExponentialAverage[short](close)
    c4 = (indicator7 CROSSES UNDER indicator8)
    
    IF c4 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    // Stops and targets
    #10185 quote
    Nicolas
    Keymaster
    Master

    If the optimizer returns you good results cases when the faster EMA has a period longer than the slow EMA, this is obviously because it gives the best results. So if you need to have a short term period for your short EMA, you can restrict the range of periods in the variables optimizations window if you like.

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

EMA Crossover Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
stevenug @stevenug Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 7 months ago.

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