Candle bars

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45992 quote
    williamtd
    Participant
    New

    Good morning , still struggling to set this up , could be an age thing !

    can some one help me code :

    day candle, for longs if close >100 pips above open but less than 150 then but 1 at next bar open

    vice Versa for shorts

    with stop entry at prior bar open

    ??

    thanks

    #46008 quote
    AutoStrategist
    Participant
    Veteran

    I think this is what you are asking for, I added an arbitrary limit to be able to test it. I ran it on the Dax futures daily and it returned 100% (27 trades) since 2012, pretty scary equity curve though

    PositionSize = 1
    
    BullBar = close > open
    BearBar = open > close
    
    TakeProfit = 100
    
    if not onmarket then
    StopLoss = open
    LatestMove = abs(close - open)
    if LatestMove > 100 and LatestMove < 150 then
    if BullBar then
    buy PositionSize shares at market
    set stop loss StopLoss
    set target profit TakeProfit
    elsif BearBar then
    sellshort PositionSize shares at market
    set stop loss StopLoss
    set target profit TakeProfit
    endif
    endif
    endif
    #46052 quote
    williamtd
    Participant
    New

    thanks for that, just run it on FX and see what you mean !

    It needs to have stop set at just above or below  previous bar by say 10 pips. And take profit at same open close range as previous bar that set up trade.

    That would trim it I think and enter exit many more trades.  is that possible to code ??

     

    William

    #46053 quote
    AutoStrategist
    Participant
    Veteran

    Certainly is, a simple change to the code I supplied, there are also plenty of code examples on the site that can help you if you need them

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

Candle bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
williamtd @williamtd Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by AutoStrategist
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/12/2017
Status: Active
Attachments: No files
Logo Logo
Loading...