Total Beginner

Viewing 15 posts - 1 through 15 (of 39 total)
  • #201870

    Hello

    I am a mother of 2 with no very much time to sit in front of the computer to watch all day the charts for set ups and I am trying to get into setting up a simple automated system. Can someone show me where I have gone wrong? Most appreciate your kind assistance.

    I would also be thankful for some pointers where I can read up / watch the best learning material for programming PRT.

     

     

    #201874

    this code is for an indicator

    1 user thanked author for this post.
    #201875

    Thanks for the pointer.

    I have rewritten the set up and there is an issue with the stop as it doesn’t properly trails the position.

    Furthermore the system doesn’t open every time the conditions are met a new position

     

    Do you know if there are any sample codes so that I can see what the approximate set up would need to look like?

     

    #201880

    Post the code you have written doing Copy and Paste, please.

     

    #201889

    Good morning.

     

    here the code, my main issues are that the code doesn’t open on each bar a position although the conditions are fulfilled and the stop is just a simple trailing stop and I would like to have it move from low close [1] to the next candle. But not sure how to write this code.

    Truly appreciate you taking time to help me out, means the world to me. Thank you!

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FLATBEFORE = 083000
    DEFPARAM FLATAFTER = 220000

    // Conditions to enter long positions
    indicator1 = ExponentialAverage[20](close)
    c1 = (close >= indicator1[1])

    IF c1 THEN
    BUY 0.5 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit long positions
    indicator2 = ExponentialAverage[20](close)
    c2 = (close CROSSES UNDER indicator2[1])

    IF c2 THEN
    SELL AT MARKET
    ENDIF
    SET STOP TRAILING 10

    // Conditions to enter short positions
    indicator1 = ExponentialAverage[20](close)
    c1 = (close <= indicator1[1])

    IF c1 THEN
    SELLSHORT 0.5 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit short positions
    indicator2 = ExponentialAverage[20](close)
    c2 = (close > indicator2)

     

    Hope this is ok.

    #201894

    I have moved this topic to ProOrder support, as it deals with strategies. Please use the correct support forum and read carefully the basic rules below (highlighted in yellow). Thank you 🙂

    Your code is missing the last lines to exit Short trades:

    as to the trailing stop, it will be updated every 10 pips (oor 10 price units, if not an index).

    1 user thanked author for this post.
    #201909

    Hi Roberto

    thank you for reviewing my code, I am stuck again and was wondering if you would be so kind to help me out. When I backtest this code it doesn’t give me any trades and I don’t see the trees for the forest anymore.

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Conditions to enter long positions
    EMA20 = ExponentialAverage[20](close)
    EMA50 = ExponentialAverage[50](close)
    avg169 = Average[169](close)

    c1 = EMA20 CROSSES OVER EMA50
    c2 = close [0] > close [1]

    IF c1 AND c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit long positions
    c3 = close [0] < avg169

    IF c3 THEN
    SELL AT MARKET
    ENDIF

    // Conditions to enter short positions
    EMA20 = ExponentialAverage[20](close)
    EMA50 = ExponentialAverage[50](close)
    avg169 = Average [169]

    c4 = EMA20 CROSSES UNDER EMA50
    c5 = close [0] < close [1]

    IF c4 AND c5 THEN
    SELL 1 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit short positions
    c6 = close > avg169

    IF c6 THEN
    SELL AT MARKET
    ENDIF

    #201911

    You have to change the instruction to enter and exit a SHORT trade:

    • BUY  enters a Long trade
    • SELL exits   a Long trade
    • SELLSHORT enters a Short trade
    • EXITSHORT exits    a Short trade

     

    1 user thanked author for this post.
    #201919
    JS
    1 user thanked author for this post.
    #201922

    Thanks you are a champ.

    Please let me know if my ‘stupid’ questions annoy you. But this is a lot of fun trying to get my ideas into a script.

    Appreciate your help! Absolutely fantastic.

    Ciao

    2 users thanked author for this post.
    #201926

    I love GraHal‘s motto “Ask a question, you may be a fool for a day. Don’t ask a question, you may be a fool for life“.

     

    2 users thanked author for this post.
    #201931

    Thank you Roberto.

    I just changed it slightly as we never view anyone as a fool for asking questions.

    Ask a question, you may feel like a fool for a day.

    Don’t ask a question, you may be a fool for life!?

    4 users thanked author for this post.
    #201965

    Roberto

    Here we go again!

    I am trying to get the code to open the candle right after the crossing, which it doesn’t do right now, see picture below. I tried to specify the candle which should trigger the entry, however now the system it returns an error message.

    // Conditions to enter long positions
    EMA20 = ExponentialAverage [20]
    EMA50 = ExponentialAverage [50]

    IF EMA20 CROSSES OVER EMA50 THEN
    LongCrossingPrice = close

    IF open [0] > close [1] THEN

    BUY 0.5 CONTRACT AT MARKET
    ENDIF

    IF close [0] < EMA50 THEN
    SELL 0.5 CONTRACT AT MARKET
    ENDIF

    // Conditions to enter short positions
    EMA20 = ExponentialAverage [20]
    EMA50 = ExponentialAverage [50]

    IF EMA20 CROSSES UNDER EMA50 THEN
    ShortCrossingPrice = close

    IF open < close [1] THEN
    SELLSHORT 0.5 CONTRACT AT MARKET
    ENDIF

    IF close [0] > EMA50 THEN
    EXITSHORT 0.5 CONTRACT AT MARKET
    ENDIF

     

    where have I gone wrong? Appreciate you pointing me in the right direction. 😉

    #201979

    Re above … no picture attached (as you said).

    Does below answer your question?

    Code is read at the end of each bar and entries / exits etc occurs at the begginning of the next bar (after code is read).

    Next bar open – and thus entry / exit – is only a few milliseconds after previous bar close.

    I believe all trading platform work same as above.

    1 user thanked author for this post.
    #201983

    Not really because I don’t see where my mistake in the code is.

    I thought I followed the structure of codes, thanks for pointing out the error

Viewing 15 posts - 1 through 15 (of 39 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login