Discussion BRENT CRUDE OIL strategy

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

    Hi,

    I found an old strategy made by @Elsborgtradern and I though of bringing it into this forum so we all could work on a better version. It doesnt have an tp or sl so thats what I´ve been working on. Ill post the code.

    Thanks,,

    .

    //-------------------------------------------------------------------------
    //TDI OIL Brent Crude (1£ Contracts) 2H Credit to ElsborgTrading
    //
    //-------------------------------------------------------------------------
    
    // code-Parameter
    DEFPARAM CumulateOrders = true
    
    //DEFPARAM FlatAfter = 230000
    //DEFPARAM Flatbefore = 030000
    
    //MONEY MGT//
    
    Equity = (Strategyprofit+20000)
    Risk = round(Equity/100000)
    Losses = positionperf(1)<0 and positionperf(2)<0 and positionperf(3)<0
    streak = positionperf(1)>0 and positionperf(2)>0 and positionperf(3)>0
    Streak2= positionperf(1)>0 and positionperf(2)>0 and positionperf(3)>0 and positionperf(4)>0
    if losses then
    PositionSize  = max(abs(round(max(3+risk-2,risk-2))),2)
    elsif not losses then
    PositionSize  = max(abs(round(max(3+risk,risk))),2)
    endif
    if streak then
    PositionSize  = max(abs(round(max(5+risk,risk))),2)
    endif
    if streak2 then
    PositionSize  = max(abs(round(max(7+risk,risk))),2)
    endif
    
    
    //TDI indicator
    //parameters :
    lengthrsi=13
    lengthrsipl=2
    lengthtradesl=7
    
    //overbought and oversold values of the TDI indicator
    upperzone = 65
    lowerzone = 7
    //upperzone = upz
    //lowerzone = loz
    
    //heiken ashi
    xClose = (Open+High+Low+Close)/4
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    xHigh = Max(xOpen, xClose)
    xLow = Min(xOpen, xClose)
    endif
    
    //indicators
    r = rsi[lengthrsi](close)
    mab = average[lengthrsipl](r)
    mbb = average[lengthtradesl](r)
    yellowMA = average[5](TypicalPrice)
    yellowMAshifted = yellowMA[2]
    
    //trade conditions
    longCondition = mab crosses over mbb AND mab<50 AND xHigh>yellowMAshifted
    shortCondition = mab crosses under  mbb AND mab>51 AND xLow<yellowMAshifted
    
    //Longsell=mab crosses under mbb AND mab<upperzone and mab>56 AND xlow>yellowMAshifted
    //Shortexit= mab crosses over mbb AND mab>lowerzone and mab<56 AND xhigh>yellowMAshifted
    Longsell=mab crosses under mbb AND mab<upperzone and mab>55 AND xlow>yellowMAshifted
    Shortexit= mab crosses over mbb AND mab>lowerzone and mab<58 AND xhigh>yellowMAshifted
    //Longsell2=mab crosses under lowerzone
    //Shortexit2=mab crosses over upperzone
    //***************************
    
    // open position
    // long
    IF Not LONGONMARKET AND longcondition THEN
    BUY PositionSize CONTRACT AT MARKET
    ENDIF
    
    // short
    IF Not SHORTONMARKET AND shortCondition THEN
    SELLSHORT PositionSize CONTRACT AT MARKET
    ENDIF
    
    // close position
    
    IF LONGONMARKET and Longsell then//or longsell2 THEN
    SELL AT MARKET
    ENDIF
    IF SHORTONMARKET and Shortexit then//or shortexit2 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    
    // stop and profit
    //SET STOP pLOSS sl
    //SET TARGET pPROFIT tp
    
    #131344 quote
    deleted23092025
    Participant
    New

    Attached the file,,

    robertogozzi, GraHal and KumoNoJuzza thanked this post
    TDI-OIL-BRENT-CRUDE-2H-v1.itf
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Discussion BRENT CRUDE OIL strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by deleted23092025
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/12/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...