MA Croosing

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3941 quote
    Michael
    Participant
    Veteran

    Hi, looking for help

    I’ve  found following Code and i don’t know how to define the variables.

    Maybee some one know it

    // ma_cross_optimised
    //works really well on 5 min ftse
    //variable y, slow ma, 36,201,5
    //variable x, fast ma, 2, 35 ,1
     
    REM Buy
     
    indicator1 = Average[x](close)
    indicator2 = Average[y](close)
    c1 = (indicator1 crosses over indicator2)
     
    IF c1 THEN
    BUY 100 shares AT MARKET nextbaropen
    ENDIF
     
     
    REM Sell
     
    indicator3 = Average[x](close)
    indicator4 = Average[y](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
     
    IF c2 THEN
    SELL  AT MARKET nextbaropen
    ENDIF
     
     
    REM Short
     
    indicator5 = Average[x](close)
    indicator6 = Average[y](close)
    c3 = (indicator5 CROSSES UNDER indicator6)
     
    IF c3 THEN
    SELLSHORT 100 shares AT MARKET nextbaropen
    ENDIF
     
     
    REM Exit short
     
    indicator7 = Average[x](close)
    indicator8 = Average[y](close)
    c4 = (indicator7 CROSSES OVER indicator8)
     
    IF c4 THEN
    EXITSHORT  AT MARKET nextbaropen
    ENDIF
    #3990 quote
    Nicolas
    Keymaster
    Master

    Hello Markus,

    The indicator 1 to indicator 8 need x and y period that you must define somewhere in the code. Just place this 2 lines at the beginning of the code :

    x = 21 //or whatever other period 
    y = 100 //or whatever
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

MA Croosing


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Michael @michael Participant
Summary

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

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 03/18/2016
Status: Active
Attachments: No files
Logo Logo
Loading...