1 Min Trading Strategy
Forums › ProRealTime English forum › ProOrder support › 1 Min Trading Strategy
- This topic has 219 replies, 29 voices, and was last updated 7 years ago by Leo.
-
-
09/26/2017 at 10:13 AM #47378
WORKS!!! PERFECT!!! Thank you!!
I will give you guys Information after runnig it a while.
09/26/2017 at 10:15 AM #47380@raphaelopilski Please sumbmit the complete code. I can’t get it to run.
09/26/2017 at 10:21 AM #47381//————————————————————————-
// Hauptcode : LongONLY
//————————————————————————-
//————————————————————————-
// Hauptcode : Long ONLY
//————————————————————————-
//Stategy: Scalping Candles
//Market: DAX
//Timeframe: 1min
//Spread: 1
//Author: Juan Jacobs (Jd3gjacobs@gmail.com)// Définition des paramètres du code
DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 090000
DEFPARAM FLATAFTER = 220000
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
noEntryAfterTime = 173000
timeEnterAfter = time < noEntryAfterTime
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0SL = 50 // 50
TP = 55 // 55
TS = 10 // 10If longonmarket and close < positionprice and (barindex-tradeindex) > 650 Then
Sell at market
ElsIf shortonmarket and close > positionprice and (barindex-tradeindex) > 60 then
Exitshort at market
EndIfbody=close-open
abody=abs(body)
if (range+0.0000001)>0 then
ratio=abody/(range+0.0000001)
else
ratio=0
endifmiddle=(open+close)/2
bodytop=max(open, close)
bodybottom=min(open, close)
shadowtop=high-bodytop
shadowbottom=bodybottom-low
longcandle= (ratio>0.6)Bull = 0
//Bullish Signals
MorningStar=(body[2]<0 and body>0 and longcandle[2] and open[1]<close[2] and open>close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and low[1]<low and low[1]<low[2] and high[1]<open[2] and high[1]<close)
if MorningStar then
Bull = 1 //Positiveendif
PiercingLine=(body[1]<0 and body>0 and longcandle[1] and longcandle and open<low[1] and close>middle[1] and close<open[1])
if PiercingLine then
Bull = 1 //None
endifAbandonedBabyBottom=(body[2]<0 and body>0 and longcandle[2] and ratio[1]<0.3 and high[1]<low[2] and high[1]<low)
if AbandonedBabyBottom then
Bull = 1 //None
endifThreeInsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishHarami[1] and close>close[1])
if ThreeInsideUp then
Bull = 1 //Positive
endifThreeOutsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishEngulfing[1] and close>close[1])
if ThreeOutsideUp then
Bull = 1 //Positive
endifThreeWhiteSoldiers=(body[2]>0 and body[1]>0 and body>0 and high[1]>high[2] and high>high[1] and close[1]>close[2] and close>close[1] and open[1]>open[2] and open[1]<close[2] and open>open[1] and open<close[1])
if ThreeWhiteSoldiers then
//Bull = 1 //Increase Drawdown
endifConcealingBabySwallow=(body[3]<0 and body[2]<0 and body[1]<0 and body<0 and ratio[3]>0.8 and ratio[2]>0.8 and ratio>0.8 and open[1]<close[2] and high[1]>close[2] and shadowtop[1]>0.6*(abody[1]+shadowbottom[1]) and bodybottom<bodybottom[1] and bodytop>high[1])
if ConcealingBabySwallow then
Bull = 1 //None
endifBullishHarami=(body[1]<0 and body>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
if BullishHarami then
//Bull = 1 //Negative Impact
endifHomingPigeon=(body[1]<0 and body<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
if HomingPigeon then
Bull = 1 //None
endifBullishEngulfing=(body[1]<0 and body>0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
if BullishEngulfing then
Bull = 1 //Positive
endifLastEngulfingBottom=(body[1]>0 and body<0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
if LastEngulfingBottom then
Bull = 1 //None
endifDragonflyDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>3*abody and shadowtop<shadowbottom/3)
if DragonflyDojiBottom then
Bull = 1 //None
endifGravestoneDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>3*abody and shadowbottom<shadowtop/3)
if GravestoneDojiBottom then
Bull = 1 //None
endifDojiStarBottom=(body[1]<0 AND longcandle[1] AND low<low[1] AND open<close[1] AND ratio<0.3 AND range<0.3*range[1])
if DojiStarBottom then
Bull = 1 //None
endifBullishHaramiCross=(body[1]<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1])
if BullishHaramiCross then
Bull = 1 //None
endifThreeStarsInTheSouth=(body[2]<0 and body[1]<0 and body<0 and shadowtop[2]<range[2]/4 and shadowbottom[2]>abody[2]/2 and low[1]>low[2] and high[1]<high[2] and abody[1]<abody[2] and shadowtop[1]<range[1]/4 and shadowbottom[1]>abody[1]/2 and low>low[1] and high<high[1] and abody<abody[1] and shadowtop<range/4 and shadowbottom<range/4)
if ThreeStarsInTheSouth then
Bull = 1 //None
endifBullishBreakaway=(body[4]<0 and body[3]<0 and body>0 and open[3]<close[4] and close[2]<close[3] and close[1]<close[2] and longcandle and close<close[4] and close>open[3])
if BullishBreakaway then
Bull = 1 //None
endifHammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
if Hammer then
Bull = 1 //None
endifInvertedHammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
if InvertedHammer then
Bull = 1 //None
endifRisingThreeMethods=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and longcandle and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
if RisingThreeMethods then
Bull = 1 //None
endifBullishThreeLineStrike=(body[3]>0 and body[2]>0 and body[1]>0 and body<0 and longcandle[3] and longcandle[2] and longcandle[1] and close[2]>close[3] and close[1]>close[2] and open>close[1] and close<open[3])
if BullishThreeLineStrike then
Bull = 1 //None
endifBullishMatHold=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and close[3]>close[4] and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
if BullishMatHold then
Bull = 1 //None
endifBullSash=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>close[1] AND open<open[1] AND close>open[1] AND shadowtop<0.1*abody)
if BullSash then
Bull = 1 //Positive
endifBullSeparatingLine=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop<0.1*abody)
if BullSeparatingLine then
Bull = 1 //None
endifBullishCounterAttack=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND close<=close[1])
if BullishCounterAttack then
Bull = 1 //None
endifBullishKicking=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop=0 AND shadowbottom=0)
if BullishKicking then
Bull = 1 //None
endifIf hour = 1 Then
Trade = 0 //resets the variable every morning
EndIf
If Trade = 0 Then
positionsize = 1 //the day will always start allowing the first trade
ElsIf Trade >= 2 and positionperf(1) > 0 and positionperf(2) > 0 Then
positionsize = 0
EndIf
//Entry/Exit Criteria
NearMA = Average[7,2](close)
If countofposition = 0 and Bull = 1 and NearMA[1] > NearMA[3] and RSI[2](close) > 60 and NearMA > Average[150,2](close) and timeEnterBefore and timeEnterAfter and not daysForbiddenEntry Then
//If shortonmarket Then
//Exitshort at market
//EndIf
Buy positionsize contract at market
Trade=Trade+1
EndIfIf countofposition = 0 and NearMA[1] < NearMA[3] and RSI[2](close) < 25 and NearMA < Average[150,2](close)and timeEnterBefore and timeEnterAfter and not daysForbiddenEntry Then
//If longonmarket Then
//Sell at market
//EndIf
//Sellshort positionsize contract at market
EndIf//trailing stop
trailingstop = TS
if not onmarket then
MAXPRICE = 0
priceexit = 0
endif//LONG order
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE – trailing stop price level
endif
endif//exit on trailing stop price levels
if onmarket and priceexit>0 then
EXITSHORT AT priceexit STOP
SELL AT priceexit STOP
endifSet Target pProfit TP
Set Stop pLoss SL1 user thanked author for this post.
09/26/2017 at 12:28 PM #47386@Juanj: I see there in your code commands like:
x=average[7,2](close)
I’m not familiar with this notation. What does the second parameter in the first bracket stand for. 7 is the period of the MA but what is this ,2 after the 7?
09/26/2017 at 1:01 PM #4739109/26/2017 at 4:01 PM #4741709/26/2017 at 4:12 PM #47418Interesting. Wonder why that would be.
I use to optimize all my strategies to only run on certain days (based on backtesting) but it always seemed to only work for a little while as the market ‘no-no’ days seem to change over time.
But suppose if you use WF and only a fraction of your data to confirm the bias it might be more relevant going forward.
09/26/2017 at 4:30 PM #47420I ran several OOS-tests with it and the bias was confirmed. Of course our history for 1min is so little that the bias can vanish whenever. At least it persisted to all history we have.
A german analyst I once had a chat with had the option that the Dax is always searching for its direction on mondays and usually tests on mondays both highs and lows. This would make the market prone to intraday reversals on mondays which than would cause losing trades.
This would be an attempt to explain why mondays are bad days but when I tested thursday were the worse (even worse than mondays) and actually the only weekday that lost money on average, mondays had a tiny plus (0.06%). For thursdays I have no explanation. But well, we don’t have to understand it to be able to trade it. 😛
09/26/2017 at 5:54 PM #47426Hallo
When I try to test the version you posted #47381 for DAX, strategy doesn’t take any position.
Do you know where the issue could be ?
Danke im Voraus
Reb
09/26/2017 at 7:30 PM #4743209/26/2017 at 10:53 PM #47440Hi everyone. Has anyone tried using a moving average of daily highs and lows as entry criteria for long or short trades? Example take the highest daily high of a long number of periods (roughly 10000) then take a moving average of this. If the price is above this then we know on a higher time frame the trend should be upwards.
09/27/2017 at 10:33 AM #4747809/27/2017 at 12:28 PM #4749709/27/2017 at 12:32 PM #47498I think if you are really determined to get the short side working, start by disabling all the bearish candle setups (//Bear = 1) and then enable them one by one, keeping only those that improve performance above the long-only version. Not all candlestick patterns are created equally. Maybe you stumble upon 2 or 3 that actually give good high-quality triggers.
1 user thanked author for this post.
09/27/2017 at 12:45 PM #47499Ok Boss…Let’s see…I will post the best result I’ll manage to get. Thx
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on