Crows&Soldiers 2M

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #136431 quote
    Francesco
    Participant
    Veteran

    Hey guys, this is a 2M strategy based on 3 crows and 3 soldiers candlestick patterns by Louis Winthorp III https://www.prorealcode.com/prorealtime-indicators/3-black-crows-3-white-soldiers/

    It works on different timeframes with various indicators (MegaFX from Nicholas, Stock RSI from nonetheless and a Bullish and Bearish detection)

    RT is pretty solid on 10-10, but not the best on 20-5 and 21-5; any suggestion for improvement is welcome.

    // Crows&Soldiers v1 by Francesco
    // ProRealCode.com
    
    defparam cumulateorders= false
    
    n= 1
    
    timeframe (6 minutes, updateonclose)
    // Stoch RSI
    lengthRSI= 4 //RSI period
    lengthStoch= 14 //Stochastic period
    smoothK= 5 //Smooth signal of stochastic RSI
    smoothD= 5 //Smooth signal of smoothed stochastic RSI
    myRSI= RSI[lengthRSI](close)
    MinRSI= lowest[lengthStoch](myrsi)
    MaxRSI= highest[lengthStoch](myrsi)
    StochRSI= (myRSI-MinRSI) / (MaxRSI-MinRSI)
    K= average[smoothK](stochrsi)*100
    D= average[smoothD](K)
    cl= K>D
    cs= K<D
    
    timeframe (4 minutes, updateonclose)
    // Bullish and Bearish Detection
    ma1= average[40](close)
    ma2= average[10](close)
    bullish= close>ma1 and close>ma2 and ma1>ma2
    
    ma11= average[40](close)
    ma21= average[10](close)
    bearish= close<ma11 and close<ma21 and ma11<ma21
    
    timeframe (2 minutes)
    // MegaFX
    period=5
    
    if barindex>period then
    hhigh = highest[period](high)
    llow = lowest[period](low)
    mean = (High + Low) / 2.0
    temp = 0.66 * ((mean - llow) / (hhigh - llow) - 0.5) + 0.67 * Ld36
    temp = Min(Max(temp, -0.999), 0.999)
    mega = Log((temp + 1.0) / (1 - temp)) / 2.0 + result / 2.0
    Ld36 = temp
    result = mega
    endif
    
    condb= result>0
    conds= result<0
    
    // Settings
    NbrCandles= 3
    Bodysize= 70 //in percentage
    BodySizeOnOff= 1 //standard 'On'
    
    //White Soldiers
    for i=0 to NbrCandles-1 do
    CondSoldier = close[i] > open[i] and close[i] > close[i+1]
    If BodySizeOnOff then
    CondBodySizeSoldier = (((close[i] - open[i]) / (high[i]- low[i])) > (BodySize / 100))
    if CondSoldier and CondBodySizeSoldier then
    else
    CondSoldier = 0
    break
    endif
    elsif CondSoldier then
    else
    CondSoldier = 0
    break
    endif
    next
    
    //Black Crows
    for i=0 to NbrCandles-1 do
    CondCrows = close[i] < open[i] and close[i] < close[i+1]
    If BodySizeOnOff then
    CondBodySizeCrows = (((open[i] - close[i]) / (high[i]- low[i])) > (BodySize / 100))
    if CondCrows and CondBodySizeCrows then
    else
    CondCrows = 0
    break
    endif
    elsif CondCrows then
    else
    CondCrows = 0
    break
    endif
    next
    
    // Time Directions
    t= time>=000000 and time<=220000
    
    // Long
    if condsoldier=1 and condb and cl and bullish and t then
    buy n contract at market
    endif
    
    // Short
    if condcrows=1 and conds and cs and bearish and t then
    sellshort n contract at market
    endif
    
    // Stop Loss
    set stop %loss 0.6
    
    //%trailing stop function
    trailingPercent = 0.29
    stepPercent = 0.23
    if onmarket then
    trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailingstart points profit
    trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stoploss
    endif
     
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    swedshare, OboeOpt, keewee and Paul thanked this post
    Schermata-2020-06-18-alle-14.39.26.png Schermata-2020-06-18-alle-14.39.26.png Schermata-2020-06-18-alle-14.41.18.png Schermata-2020-06-18-alle-14.41.18.png
    #136495 quote
    swedshare
    Participant
    Senior

    Nice strategy. Would you like to share the ITF?

    #136511 quote
    Francesco
    Participant
    Veteran

    You can easily copy and paste the code in your platform; anyway here it is in attachment.

    I forgot to mention than the strategy can be used on any forex pair and maybe on indexes with a proper optimization, but I feel like it misses something to reach a “live account” stability.

    GraHal thanked this post
    CrowsSoldiers-v1.itf
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Crows&Soldiers 2M


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Francesco
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/18/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...