FTSE EMA crossing code

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #124167 quote
    rsd001
    Participant
    New

    Hi,

    Im not very good at coding, can anyone support by building the code for an ema crossover system.

    I’m looking at using 10 and 25 ema.

    1. buy when the 10 ema cross’s the 25 ema in an upward direction and close when it crosses in a downward direction.
    2. sell when the 10 ema cross’s the 25 ema in a downward direction and close when it cross’s in an upward direction

    can anyone do this for me

    please email.

    #124168 quote
    Vonasi
    Moderator
    Master

    rsd001 – Welcome to the forums. If you post your request in the correct forum then you might have a better chance of some assistance. ProBuilder is for indicator questions and ProOrder is for strategy questions. I will move your topic to the correct forum. Please try to be more careful when posting future topics to ensure that they are in the right place. 🙂

    #124170 quote
    nonetheless
    Participant
    Master

    What you’ve described would look like this:

    indicator1 = ExponentialAverage[10](typicalPrice)
    indicator2 = ExponentialAverage[25](typicalPrice)
    c1 = (indicator1 > indicator2 and indicator1[1] < indicator2[1])
    c2 = (indicator1 < indicator2 and indicator1[1] > indicator2[1])

    You then add c1 and c2 to your entry and exit conditions as necessary.

    If you’re interested in this kind of strategy you should also have a look at this:

    Optimization moving average crossing strategy

    a program that finds optimal pairs of 69 different crossing MAs.

    #124173 quote
    nonetheless
    Participant
    Master

    The whole thing would look something like this:

    DEFPARAM cumulateOrders = False // Cumulating positions deactivate
    Defparam flatbefore = 080000
    Defparam flatafter = 163000
    
    //strategy
    indicator1 = ExponentialAverage[10](typicalPrice)
    indicator2 = ExponentialAverage[25](typicalPrice)
    c1 = (indicator1 > indicator2 and indicator1[1] < indicator2[1])
    c2 = (indicator1 < indicator2 and indicator1[1] > indicator2[1])
    
    // Conditions to enter long positions
    IF NOT LongOnMarket AND c1 THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    If LongOnMarket AND c2 THEN
    SELL AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket AND c2 THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    IF ShortOnMarket AND c1 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    SET STOP %LOSS 1
    SET TARGET %PROFIT 2
    #124236 quote
    rsd001
    Participant
    New

     

    thanks

    #124237 quote
    rsd001
    Participant
    New

    @nonetheless.

    this is great, ill try it today.

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

FTSE EMA crossing code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
rsd001 @rsd001 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by rsd001
5 years, 11 months ago.

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