How to hide code for my trading strategy to be used by others

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #141579 quote
    Sean.Banis
    Participant
    New

    Hi

     I am a new member 🙂

    I have coded for 2 years now.

    My result is up and down.

    I have done a code that I want to send to my friends but I don’t want them to see my code.

    I read that I can hide indicators in the code but I don’t know how.

    For example, here is a code from library.

    How can you hide as much as possible from this example code.

    Can I do the whole code as an indicator an encrypt it, except trailing SL?

    Best regards Sean

    //************************************************************************
    //                 Kama & Sma Trading System DAX mtf
    //************************************************************************
    //
    DEFPARAM CumulateOrders = False
    DEFPARAM PreLoadBars    = 2000
    ////////////////////////////////////////////////////////////////////////
    TIMEFRAME (default)
    ONCE nLots         = 1
    ONCE LongTrading   = 1                                //1=allowed   0=banned
    ONCE ShortTrading  = 1                                //1=allowed   0=banned
    //
    ONCE TP            = 200                              //200  pips
    ONCE SL            = 50                               //50   pips
    //
    TimeForbidden      = OpenTime < 090000 AND OpenTime > 190000
    LongCond           = (Not TimeForbidden) AND LongTrading
    ShortCond          = (Not TimeForbidden) AND ShortTrading
    //
    TIMEFRAME (1 hour, updateonclose)                                             //h1
    IF Not OnMarket THEN
     BarCount = 0
    ELSE
     BarCount = BarCount + 1
    ENDIF
    //------------------------------------------------------------------------------------
    //                         Kama & Sma Strategy
    //
    //https://www.forexstrategiesresources.com/trend-following-forex-strategies/111-kama-strategy/
    //
    Period     = 2                                              //2        (standard 10)
    FastPeriod = 2                                              //standard
    SlowPeriod = 30                                             //standard
    //
    Fastest  = 2 / (FastPeriod + 1)
    Slowest  = 2 / (SlowPeriod + 1)
    if barindex >= (Period + 1) then
     Num   = abs(close-close[Period])
     Den   = summation[Period](abs(close-close[1]))
     ER    = Num / Den
     Alpha = SQUARE(ER *(Fastest - Slowest )+ Slowest)
     Kama  = (Alpha * Close) + ((1 -Alpha)* Kama[1])
    else
     Kama  = close
    endif
    //------------------------------------------------------------------------------------
    Sma        = average[22,0](close)                           //22
    //------------------------------------------------------------------------------------
    a1 = Kama CROSSES OVER  Sma
    // --- SHORT
    b1 = Kama CROSSES UNDER Sma
    ////////////////////////////////////////////////////////////////////////
    TIMEFRAME (default)                                                           //1 min
    ONCE TradeON = 1
    IF IntraDayBarIndex = 0 THEN
     TradeON = 1
    ENDIF
    TradeBar = BarCount
    IF Not OnMarket AND TradeBar <> TradeBar[1] THEN
     TradeON = 1
    ENDIF
    //************************************************************************
    //                           LONG  trades
    //************************************************************************
    IF a1 AND TradeON AND LongCond THEN
     BUY nLots CONTRACT AT MARKET
     TradeON = 0
    ENDIF
    //************************************************************************
    //                           SHORT trades
    //************************************************************************
    IF b1 AND TradeON AND ShortCond THEN
     SELLSHORT nLots CONTRACT AT MARKET
     TradeON = 0
    ENDIF
    //
    SET TARGET pPROFIT TP
    SET STOP   pLOSS   SL
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                Trailing Stop
    //------------------------------------------------------------------------------------
    IF Not OnMarket THEN
     TrailStart    = 10          //10     Start trailing profits from this point
     BasePerCent   = 0.100       //10.0%  Profit to keep
     StepSize      = 6           //6      Pips chunks to increase Percentage
     PerCentInc    = 0.100       //10.0%  PerCent increment after each StepSize chunk
     RoundTO       = -0.5        //-0.5   rounds to Lower integer,  +0.4 rounds to Higher integer
     PriceDistance = 7 * pipsize//8.9    minimun distance from current price
     y1            = 0
     y2            = 0
     ProfitPerCent = BasePerCent
    ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG
     x1 = (close - tradeprice) / pipsize                            //convert price to pips
     IF x1 >= TrailStart THEN                                       //go ahead only if N+ pips
      Diff1         = abs(TrailStart - x1)
      Chunks1       = max(0,round((Diff1 / StepSize) + RoundTO))
      ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc))
      ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
      y1 = max(x1 * ProfitPerCent, y1)                            //y = % of max profit
     ENDIF
    ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN//SHORT
     x2 = (tradeprice - close) / pipsize                            //convert price to pips
     IF x2 >= TrailStart THEN                                       //go ahead only if N+ pips
      Diff2         = abs(TrailStart - x2)
      Chunks2       = max(0,round((Diff2 / StepSize) + RoundTO))
      ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc))
      ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
      y2 = max(x2 * ProfitPerCent, y2)                           //y = % of max profit
     ENDIF
    ENDIF
    IF y1 THEN                                        //Place pending STOP order when y>0
     SellPrice = Tradeprice + (y1 * pipsize)        //convert pips to price
     IF abs(close - SellPrice) > PriceDistance THEN
      IF close >= SellPrice THEN
       SELL AT SellPrice STOP
      ELSE
       SELL AT SellPrice LIMIT
      ENDIF
     ELSE
      SELL AT Market
     ENDIF
    ENDIF
    IF y2 THEN                                        //Place pending STOP order when y>0
     ExitPrice = Tradeprice - (y2 * pipsize)        //convert pips to price
     IF abs(close - ExitPrice) > PriceDistance THEN
      IF close <= ExitPrice THEN
       EXITSHORT AT ExitPrice STOP
      ELSE
       EXITSHORT AT ExitPrice LIMIT
      ENDIF
     ELSE
      EXITSHORT AT Market
     ENDIF
    ENDIF
    #141580 quote
    Nicolas
    Keymaster
    Master

    ProOrder code must remains visible (not hidden). So the workaround is to use hidden indicator(s) that deals with the trading signals, that are CALLed by the strategy.

    Of course, all orders management and instructions only compatible with ProOrder must remain in the strategy, so there is always a visible part on how you manage orders.

    #141589 quote
    Sean.Banis
    Participant
    New

    Thanks for replay Nicolas

    I’m not that good at this.

    What would the example code look like if you were to hide as much as possible.

    It’s easier easier to understand with an example 🙂

    #141598 quote
    Nicolas
    Keymaster
    Master

    Never used a CALL in 2 years of coding? 😉

    Anyway, just a quick example:

    My strategy is an RSI crossing the level 50, it generates a return variable of 1 = buy and -1 = sellshort.

    a = rsi[14]
    
    signal = 0
    
    if a crosses over 50 then 
     signal = 1
    elsif a crosses under 50 then 
     signal = -1
    endif 
    
    return signal

    Now in your ProOrder code, make a CALL of this indicator:

    signal = CALL "my-indicator-signal"
    
    if signal = 1 then 
     buy at market 
    endif 
    
    if signal = -1 then 
     sellshort at market 
    endif
    Midlanddave and rrmp12 thanked this post
    #141599 quote
    Sean.Banis
    Participant
    New

    Thank you Nicolas

    Now I understand better 🙂

    #141604 quote
    snucke
    Participant
    Veteran

    But if you export a strategy with the function “CALL” in it, wont that just import the indicators on its own so the indicators are visible?

    #141605 quote
    Nicolas
    Keymaster
    Master

    True so I suggest exporting the hidden indicator as a standalone itf file and send the strategy as a text file, in order to get rid or any ‘error’..

    Anyway, this process will be greatly improved with the marketplace (no export anymore, automatic installation, automatic update, ..). If you want to be featured as a seller, you can contact me at market[at]prorealcode.com

    #141609 quote
    snucke
    Participant
    Veteran

    sounds great!

    how is the progress going on the marketplace? do you think it will be up and running in 2020?

    #141617 quote
    Nicolas
    Keymaster
    Master

    2020 will be the year of the marketplace launch, no doubt! 🙂 I’m finalizing the recurring payments process for products with limited time use.

    snucke and GraHal thanked this post
    #253374 quote
    Aragorna
    Participant
    Junior

    Hi Nicolas, I’d like to sell my strategies in market place, I’ve opened my store but I have no idea how to seel them and to hide code. Is there a guide somewhere? I cannot find available information and that’s incredible.

     

    thanks

     

    Alessio

    #253375 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    if you’ve opened your store, then once logged in, on your seller dashboard you have a menu column on the left side, 13th item is called “documentation”, click on it, from there PDF guide is at top of the page.

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

How to hide code for my trading strategy to be used by others


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Sean.Banis @sean-banis Participant
Summary

This topic contains 10 replies,
has 5 voices, and was last updated by JC_Bywan
3 months, 1 week ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/14/2020
Status: Active
Attachments: No files
Logo Logo
Loading...