Spot/Binary Scalper V0

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #84192 quote
    kryomancer86
    Participant
    Veteran

    //@version=2
    strategy(title='[STRATEGY][RS]Spot/Binary Scalper V0′, shorttitle=’IC’, overlay=true, initial_capital=100000, currency=currency.USD)
    // || Adapted from:
    // || http://www.binaryoptionsedge.com/topic/1414-ta-spot-scalping-it-works-damn-good/?hl=singh

    // || Ichimoku cloud:
    conversionPeriods = input(title=’Conversion Periods:’, type=integer, defval=7, minval=1),
    basePeriods = 26//input(title=’Base Periods’, type=integer, defval=26, minval=1)
    laggingSpan2Periods = 52//input(title=’Lagging Span:’, type=integer, defval=52, minval=1),
    displacement = 26//input(title=’Displacement:’, type=integer, defval=26, minval=1)

    f_donchian(_len) => avg(lowest(_len), highest(_len))

    f_ichimoku_cloud(_conversion_periods, _base_periods, _lagging_span)=>
    _conversion_line = f_donchian(_conversion_periods)
    _base_line = f_donchian(_base_periods)
    _lead_line1 = avg(_conversion_line, _base_line)
    _lead_line2 = f_donchian(_lagging_span)
    [_conversion_line, _base_line, _lead_line1, _lead_line2]

    [conversionLine, baseLine, leadLine1, leadLine2] = f_ichimoku_cloud(conversionPeriods, basePeriods, laggingSpan2Periods)

    //ps0 = plot(title=’A’, series=leadLine1, color=green, linewidth=2)
    //ps1 = plot(title=’B’, series=leadLine2, color=red, linewidth=2)
    //fill(title=’AB’, plot1=ps0, plot2=ps1, color=blue, transp=80)
    //plot(title=’Base’, series=baseLine, color=blue, linewidth=1, offset=displacement)
    plot(title=’Conversion’, series=conversionLine, color=blue, linewidth=1)
    // ||———————————————————————————————————————————————-||
    // || ADX
    len = input(title=”Length”, type=integer, defval=14)
    th = input(title=”threshold”, type=integer, defval=20)

    TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
    DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
    DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0

    SmoothedTrueRange = nz(SmoothedTrueRange[1]) – (nz(SmoothedTrueRange[1])/len) + TrueRange
    SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) – (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
    SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) – (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus

    DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
    DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
    DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
    ADX = sma(DX, len)
    // ||———————————————————————————————————————————————-||
    // || Trade session:
    USE_TRADESESSION = input(title=’Use Trading Session?’, type=bool, defval=true)
    trade_session = input(title=’Trade Session:’, type=string, defval=’0400-1500′, confirm=false)
    istradingsession = not USE_TRADESESSION ? false : not na(time(‘1′, trade_session))
    bgcolor(istradingsession?gray:na)
    // ||———————————————————————————————————————————————-||
    // || Strategy:
    trade_size = input(title=’Trade Size:’, type=integer, defval=10000)
    stop_loss_in_ticks = input(title=’Stop Loss in ticks:’, type=integer, defval=150)
    take_profit_in_ticks = input(title=’Take Profit in ticks:’, type=integer, defval=200)

    buy_icloud_signal = open < conversionLine and close > conversionLine
    buy_adx_signal = DIPlus > 20
    buy_signal = istradingsession and buy_icloud_signal and buy_adx_signal

    sel_icloud_signal = open > conversionLine and close < conversionLine
    sel_adx_signal = DIMinus > 20
    sel_signal = istradingsession and sel_icloud_signal and sel_adx_signal

    strategy.order(‘buy’, long=true, qty=trade_size, comment=’buy’, when=buy_signal)
    strategy.order(‘sel’, long=false, qty=trade_size, comment=’sel’, when=sel_signal)

    strategy.exit(‘exit buy’, from_entry=’buy’, profit=take_profit_in_ticks, loss=stop_loss_in_ticks)
    strategy.exit(‘exit sel’, from_entry=’sel’, profit=take_profit_in_ticks, loss=stop_loss_in_ticks)

    #84195 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums.

    Are you requesting to have this adapted to PRT code?

    You have posted in the forum for indicators and this is a strategy code so I will move it to the correct forum for ProOrder strategies.

    Please try to post in the correct forum with future posts.

    Nicolas will most likely be along soon to let you know if it is something that he can convert to PRT code.

    #84197 quote
    kryomancer86
    Participant
    Veteran

    Thanks Vonsai, yes I would like to convert it to PRT code.

    My apologies for posting in the wrong forum, I’ll make sure next time it’s in the right forum.

    #84293 quote
    Nicolas
    Keymaster
    Master

    and please next time, please don’t just copy/paste code without at least one sentence that explain the code and how it should operates. Translation of code is not made by a robot, but by a real human 🙂 Some common human words are very useful for each request, like “hi, please, thank you”. I also do appreciate screenshot of the template that show entries and exit.

    Anyway, I’ll have a look ASAP.

    GraHal thanked this post
    #84315 quote
    kryomancer86
    Participant
    Veteran

    Hi Nicolas,

    I’m really sorry for not posting it as a proper request. I’m new to this forum and trying to learn how things work here.

    When I upload the code through the website I thought it will be done automatically, my mistake, I had to write a proper post.

    I was trying to convert the code myself but I didn’t manage to find the equal command in PRC for these lines:

     

    take_profit_in_ticks = input(title=’Take Profit in ticks:’, type=integer, defval=200)

    strategy.exit(‘exit buy’, from_entry=’buy’, profit=take_profit_in_ticks, loss=stop_loss_in_ticks)

     

    Can we actually take profit or loss in ticks in PRC? This strategy is from TradingView.

    Thank you for your time and help in advance,

    #84327 quote
    Nicolas
    Keymaster
    Master

    Much often the tick size is the same as pip size, but you can also do conversion by comparing the 2 values with PIPSIZE and TICKSIZE.

    Once you have found the correct value, set your take profit with:

    SET TARGET PROFIT myvalue
    #84376 quote
    kryomancer86
    Participant
    Veteran

    Thanks for your help Nicolas 🙂

    I will do, the rest of the code seems quite straightforward to implement in PRC.

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

Spot/Binary Scalper V0


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by kryomancer86
7 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/05/2018
Status: Active
Attachments: No files
Logo Logo
Loading...