Candlestick Scalper 1s discussion
Forums › ProRealTime English forum › ProOrder support › Candlestick Scalper 1s discussion
- This topic has 171 replies, 16 voices, and was last updated 2 years ago by CMM.
-
-
04/14/2020 at 9:10 AM #126039
i wil try.. i’m confused
the test..123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172//-------------------------------------------------------------------------// Code principal : CANDLE//-------------------------------------------------------------------------Defparam cumulateorders = falsen =1timeframe(15 minute,updateonclose)c160m = open > open[1] and close > close[1] and close > opentimeframe(1 minute,updateonclose)c11m = open > open[1] and close > close[1]c21m = abs(close-open) >= 17c31m = abs(close[1]-open[1])c41m = c31m > c21mtimeframe(default)c1def = open > open[1] and close > close[1]c2def = abs(close-open) >= 1IF not longonmarket and c1def and c11m and c21m and c41m and c2def and c1def and c160m thenBUY N contracts at marketset stop ploss 300ENDIF//if longonmarket and close crosses under st then//sell at market//endif//************************************************************************//trailing stop functiontrailingstart = 19 //trailing will start @trailinstart points profittrailingstep = 7 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************04/14/2020 at 9:35 AM #126045Also 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?
04/14/2020 at 9:43 AM #12604604/14/2020 at 9:45 AM #126048MIssing in either version (backtest / demo)
ok, i will add bardindex
1 user thanked author for this post.
04/14/2020 at 3:36 PM #126110to 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
1234defparam cumulateorders = falsedefparam preloadbars = 10000defparam flatbefore = 080000defparam flatafter = 153000then 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.
04/14/2020 at 4:36 PM #126127to 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
1234defparam cumulateorders = falsedefparam preloadbars = 10000defparam flatbefore = 080000defparam flatafter = 153000then 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
04/16/2020 at 8:49 AM #126354Hi
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.
04/16/2020 at 9:04 AM #12635904/16/2020 at 9:22 AM #12636104/16/2020 at 9:45 AM #12636704/16/2020 at 9:51 AM #12636904/16/2020 at 9:54 AM #126370i’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
04/16/2020 at 10:24 AM #126374indeed 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?
12345678910111213141516171819202122232425262728// point pivot [fifi743]if dayofweek < dayofweek[1] thenweeklyhigh = prevweekhighweeklylow = prevweeklowweeklyclose = prevweekcloseprevweekhigh = highprevweeklow = lowweeklypivot = (weeklyhigh + weeklylow + weeklyclose) / 3endifprevweekhigh = max(prevweekhigh, high)prevweeklow = min(prevweeklow, low)prevweekclose = closeif dayofweek = 1 thendayhigh = dhigh(2)daylow = dlow(2)dayclose = dclose(2)endifif dayofweek >=2 and dayofweek < 6 thendayhigh = dhigh(1)daylow = dlow(1)dayclose = dclose(1)endifpivot = (dayhigh + daylow + dayclose) / 3ecart=2ecartwp=304/16/2020 at 10:54 AM #126378yes, 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 ?
04/16/2020 at 11:10 AM #126379 -
AuthorPosts
Find exclusive trading pro-tools on