Long code works but not with shorty code added?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #181321 quote
    bearbullbearbull
    Participant
    Average
    //GBPUSD STOCH RSI SMA Lose
    DEFPARAM CumulateOrders = true//
    tradestart = time > 090000
    Tradeend= time < 210000
     
     
    TP =50
    SL =500
     
    SMA5 = Average[5](close)
    SMA10 = Average[10](close)
    STOCH = Stochastic[14,3](close)
    indicator4 = Average[5](STOCH)
    RSIind = RSI[14](close)
     
    // Conditions to enter long positions
    c1 = (SMA5 CROSSES OVER SMA10)
    c2 = (STOCH - indicator4 >10)//Stochastic upward momentum
    c3 = (RSIind > 45)//RSI upward momentum
    c5 = (average[10](STOCH)<45)// Stochastic not yet overbought
     
    //Conditions to enter short
    d1 = (SMA5 CROSSES UNDER SMA10)
    d2 = (STOCH - indicator4 <-10)//Stochastic downward momentum
    d3 = (RSIind < 55)//RSI downward momentum
    d5 = (average[10](STOCH)>55)//Stochastic not yet oversold
     
    IF c1 AND c2 AND c3 AND c5 AND tradestart AND tradeend THEN
    BUY 2 CONTRACT AT MARKET
    Set target pprofit TP
    SET STOP pLOSS SL
    
    IF d1 AND d2 AND d3 AND d5 AND tradestart AND tradeend THEN
    SELL 2 CONTRACT AT MARKET
    Set target pprofit TP
    SET STOP pLOSS SL
    ENDIF
    
    //IF d1 AND d2 AND d3 AND d5 AND tradestart AND tradeend THEN
    //SELLshort 1 CONTRACT AT MARKET
    //Set target pprofit TP
    //SET STOP pLOSS SL
    //ENDIF
    #181322 quote
    bearbullbearbull
    Participant
    Average

    I cannot get this to work with the short code added at the bottom? keeps telling me a bout a problem in line 44 or 45?

    #181323 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Comment out lines 33-37 and uncomment lines 39-43.

    #181343 quote
    PeterStPeterSt
    Participant
    Master

    You have a missing EndIf there (see attachment).

    robertogozzi thanked this post
    image_2021-11-09_231624.png image_2021-11-09_231624.png
    #181688 quote
    bearbullbearbull
    Participant
    Average

    Yes, ENDIF was the culprit!!! Long hours staring at screens and this simple mistake was sooooo obvious.

    Thank you for help and the solution

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Long code works but not with shorty code added?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
bearbull @bearbull Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by bearbullbearbull
4 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/09/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...