Candlestick Scalper 1s discussion

Viewing 15 posts - 61 through 75 (of 172 total)
  • Author
    Posts
  • #126039 quote
    MAKSIDE
    Participant
    Veteran

    i wil try.. i’m confused

    //-------------------------------------------------------------------------
    // Code principal : CANDLE
    //-------------------------------------------------------------------------
    Defparam cumulateorders = false
    
    n =1
    
    timeframe(15 minute,updateonclose)
    c160m = open > open[1] and close > close[1] and close > open
    
    
    timeframe(1 minute,updateonclose)
    c11m = open > open[1] and close > close[1]
    c21m = abs(close-open) >= 17
    c31m = abs(close[1]-open[1])
    c41m = c31m > c21m
    
    timeframe(default)
    c1def = open > open[1] and close > close[1]
    c2def = abs(close-open) >= 1
    
    
    
    IF not longonmarket and c1def and c11m and c21m and c41m and c2def and c1def and c160m then
    BUY N contracts at market
    set stop ploss 300
    ENDIF
    
    //if longonmarket and close crosses under st then
    //sell at market
    //endif
    
    //************************************************************************
    //trailing stop function
    trailingstart = 19 //trailing will start @trailinstart points profit
    trailingstep = 7 //trailing step to move the "stoploss"
     
    //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*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    
    Capture1-1.png Capture1-1.png
    #126045 quote
    GraHal
    Participant
    Master

    Also try putting a barindex number in the System to start … so that both backtest and Forward Test start on the same bar number or even a time?? (to nearest second) e.g. 100001

    Taking into account conditions in your code … unless both backtest and forward test start at EXACTLY the same bar or time then there will be differences?

    Let us know how you get on please?

    #126046 quote
    MAKSIDE
    Participant
    Veteran

    always the same things after some init/click and so one

    for the backtest, i took a spread set to 6

    Capture-14.png Capture-14.png
    #126048 quote
    MAKSIDE
    Participant
    Veteran

    MIssing in either version (backtest / demo)

    ok, i will add bardindex

    bertrandpinoy thanked this post
    #126110 quote
    Paul
    Participant
    Master

    to get in in sync backtest & demo, perhaps focus on trading times outside market hours with low(est) spread on dji.

    I use this & spread 6

    defparam cumulateorders = false
    defparam preloadbars    = 10000
    defparam flatbefore     = 080000
    defparam flatafter      = 153000

    then perhaps another code from inside market hours, this has about the same spread  but market behaves different.

    Most important, dont take any trade in the time range with highest spread. Stoploss & trailing stop will likely be out of sync compared to backtest.

    #126127 quote
    MAKSIDE
    Participant
    Veteran

    to get in in sync backtest & demo, perhaps focus on trading times outside market hours with low(est) spread on dji.

    I use this & spread 6

    then perhaps another code from inside market hours, this has about the same spread but market behaves different.

    Most important, dont take any trade in the time range with highest spread. Stoploss & trailing stop will likely be out of sync compared to backtest.

    Thx Paul. I will try it too

    #126354 quote
    MAKSIDE
    Participant
    Veteran

    Hi

    I need help in order to find the best way..  for the moment the strategy wins as long as we are in the trend.

    of course, sometimes, rarely, under 1s, despite the security in place on higher timeframe, the initial SL may can be reached

    So, in this case, i’m trying to find the best way to go out cleanly by limiting losses..

    i have already tried several types of stoploss or exit way..

    Do you an interesting idea about SL or so one ? under 1s, the it’s very hard to control the trend.

    Capture8.png Capture8.png
    #126359 quote
    MAKSIDE
    Participant
    Veteran

    i also tried with an initial target profit based on ATR to limite damage and to reache the sl when pullback…

    #126361 quote
    GraHal
    Participant
    Master

    If you post latest code as an .itf then we can be trying to make improvements also?

    Be quicker than us suggesting to you and you having to do it all?

    #126367 quote
    MAKSIDE
    Participant
    Veteran

    yes grahal, for the moment, i just want to resolve this part

    it’s the code above (with sl 300) that i’m testing

    GraHal thanked this post
    #126369 quote
    Paul
    Participant
    Master

    was the trade with exit on stoploss anytime in profit and if so how much?

    #126370 quote
    MAKSIDE
    Participant
    Veteran

    i’m testing in live since yesterday in order to check already that the positions in live are the same in backtest..  for the moment it’s good on 1s (6 trades/6 wins)

    in example, sl not reached but as soon as the numbers of candle is very long it may can reach the sl..  of course, a test according to the number of candles would be easy but not the best way

    capture12.png capture12.png
    #126374 quote
    Paul
    Participant
    Master

    indeed it would be too much curve-fitting.  About 7 hours in a trade on 1s and you ended positive, you can call it luck!

    If the trade was positive at any time, then you can use a breakeven to lower the stoploss, say from 300 points stoploss to 150 points.

    Also, would this from fifi743 be usefull? and/or maybe modify it to suite a lower timeframe?

    // point pivot [fifi743]
    if dayofweek < dayofweek[1] then
    weeklyhigh = prevweekhigh
    weeklylow = prevweeklow
    weeklyclose = prevweekclose
    prevweekhigh = high
    prevweeklow = low
    weeklypivot = (weeklyhigh + weeklylow + weeklyclose) / 3
    endif
     
    prevweekhigh = max(prevweekhigh, high)
    prevweeklow = min(prevweeklow, low)
    prevweekclose = close
    
    if dayofweek = 1 then
    dayhigh = dhigh(2)
    daylow = dlow(2)
    dayclose = dclose(2)
    endif
    if dayofweek >=2 and dayofweek < 6 then
    dayhigh = dhigh(1)
    daylow = dlow(1)
    dayclose = dclose(1)
    endif
    
    pivot = (dayhigh + daylow + dayclose) / 3
    ecart=2
    ecartwp=3
    #126378 quote
    MAKSIDE
    Participant
    Veteran

    yes, thx Paul..  but the luck smiles.. in demo (no sl reached since 2 weeks..)

    of course, i’m try to confirm the trend by a pivot and indeed sl would be divide by 2 , i already thought about it..  for the moment, i tried on pivot 1H..

    i’m going to test your proposal..  just a question, how are managed the variable ecart et ecartwp ?

    #126379 quote
    MAKSIDE
    Participant
    Veteran

    i’m also trying to apply at the same time an exitshort when there is a reverse signal according to the summation and number of red candle in order to gain wheen it starts to lose

    Capture60.png Capture60.png
Viewing 15 posts - 61 through 75 (of 172 total)
  • You must be logged in to reply to this topic.

Candlestick Scalper 1s discussion


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
MAKSIDE @makside Participant
Summary

This topic contains 171 replies,
has 16 voices, and was last updated by CMM
3 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/07/2020
Status: Active
Attachments: 62 files
Logo Logo
Loading...