@lisamitch50
I’d love to get screenshots of the examples you mentioned. It’d be much easier for me to visualize the changes to do 🙂
Or if you don’t manage to attach screenshots, you could tell me what candle you’re talking about (with accuracy)
Tbh, I made up my own definition of a pinbar, which is that the wick should be at least 3 times the length of the body and the tail (the opposite one) should be small. But I’d rather have your definition since your strategy seems to be doing well
I’ll try and add the short version to the long one when I can. It’s easier for me to focus on one only for now haha
the import of the ITF code does not work .. am I the only one?
How are you doing the Import and at what point does it fail for you?
Are you talking about a specific .itf?
Import always works for me.
thank you for reply,
I load the file as usual.
here is the error message attached (French language).
I restarted PRT to rule out this failure hypothesis.
I have experimented with other ITF codes, it works. Strange isn’t it ..
I just imported and backtested the same .itf no trouble at all. I am on v10.3
I can’t read the French message, but I can write French with the help of the onboard translator!! 🙂
Are you using v10.3 or v11?
this time I restarted the computer to remove a doubt.
but that did not change the download error.
however the function accepts to load other codes … really curious …
i would like to see this code, can you put the code as text please? thanks again.
There you go …
// Dax - 1H
// Original idea by lisamitch50 on prorealcode.com
//*******************
// Paramètres du code
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
DEFPARAM PRELOADBARS = 50000
//Trading hours
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
//----------------------------------------------------
//*********************
// Variables
cLengthNb = 15
bLengthNb = 3
//-----------------------------------------------------
//**********************
// Hammers and inverted hammers (aka pin bars)
body = max(open, close) - min(open, close)
LowerShadow = min(open, close) - low
UpperShadow = high - max(open, close)
// Minimum Length for the whole candle (shadows included)
if high - low >= cLengthNb then
candleLength = 1
else
candleLength = 0
endif
//graph candleLength as "candleLength"
// Minimum length for the body (from open to close)
if body >= bLengthNb then
bodyLength = 1
else
bodyLength = 0
endif
//graph bodyLength as "bodyLength"
// If Lowershadow is at least 3 times the body length and the UpperShadow is at most half the length of the LowerShadow then it's a hammer
if (LowerShadow >= 3 * body) and (UpperShadow <= LowerShadow * 0.5) and candleLength and bodyLength then
Hammer = 1
HamHigh = high
HamLow = low
else
Hammer = 0
HamHigh = 0
HamLow = 0
endif
graph Hammer as "Hammer"
// If UpperShadow is at least 3 times the body length and the LowerShadow is at most half the length of the UpperShadow then it's an inverted hammer
if (UpperShadow >= 3 * body) and (LowerShadow <= UpperShadow * 0.5) and candleLength and bodyLength then
InvertedHammer = 1
HamHigh = high
HamLow = low
else
InvertedHammer = 0
HamHigh = 0
HamLow = 0
endif
graph InvertedHammer as "InvertedHammer"
//---------------------------------------------------------
//*********************
// Pinbar must close below the body of the previous candle to allow buying
if close < min(open[1], close[1]) then
below = 1
else
below = 0
endif
graph below as "below"
// Pinbar must close above the body of the previous candle to allow selling
if close > max(open[1], close[1]) then
above = 1
else
above = 0
endif
graph above as "above"
//------------------------------------------------------
//***********************
// Close of the pinbar must be within the 61.8%-100% range (/!\ some changes to make if there are two tails)
candle = high - low
// LowerShadow
if LowerShadow >= candle * 0.618 then
FiboRangeHam = 1
else
FiboRangeHam = 0
endif
graph FiboRangeHam as "FiboRangeHam"
// UpperShadow
if UpperShadow >= candle * 0.618 then
FiboRangeInvHam = 1
else
FiboRangeInvHam = 0
endif
graph FiboRangeInvHam as "FiboRangeInvHam"
//----------------------------------------------------
//********************
// Useless condtition for tests
if Hammer or InvertedHammer or HamHigh or HamLow or above or below or FiboRangeHam or FiboRangeInvHam then
endif
MyRSI = RSI[14]
if myRSI > 99 then
Vosconditions = 1
endif
//--------------------------------------------------------------
//*********************
// Conditions to go long
// If it's a hammer, that close is below the body of the previous bar and that it's within the 61.8%-100% range then
IF NOT LongOnMarket and not daysForbiddenEntry and Hammer and below and FiboRangeHam THEN
//BUY 1 CONTRACTS AT MARKET
EntryPrice = high
BUY 1 CONTRACT AT EntryPrice STOP // pending order
lossNb = candle + 10
profitNb = candle
set stop pLoss lossNb
set target pProfit profitNb
a = 1
followingBarsUp = 4 // allows 3 bars after that one to reach 100% Fibo and go long
money = strategyprofit
ENDIF
graph a as "a"
followingBarsUp = followingBarsUp - 1
graph followingBarsUp as "followingBars"
if strategyprofit <> money then
followingBarsUp = 0
endif
if followingBarsUp = 0 then // if the conditions to go long were true 4 bars ago but no longer are, then going long is no longer allowed
a = 0
endif
graph a as "a"
if not LongOnMarket and not daysForbiddenEntry and a = 1 and (followingBarsUp > 0) then // if the conditions were true 4 bars ago, then go long
BUY 1 CONTRACT AT EntryPrice STOP
lossNb = candle + 10
profitNb = candle
set stop pLoss lossNb
set target pProfit profitNb
endif
// Conditions pour fermer une position acheteuse
If LongOnMarket AND VosConditions THEN
SELL AT MARKET
ENDIF
Yeah good idea … copy and paste the above straight into backtest on your Platform!? 🙂
I find this code original and opening up possibilities. can the author make a version for sale or am I saying something stupid?
@lisamitch50
original and opening up possibilities.
So did you find out why you couldn’t import?
The Strategy is
lisamitch50 and the code Author is
BobOgden
Thank you to both for sharing your time, effort and ingenuity with us all.
well no, the mystery remains intact to this day …
I know it is nowhere near finished, but with a very quick play, I get attached so far (Spread = 3).
Always good to show as profitable even while under development! 🙂
Hey
@bertrandpinoy, I have no clue as to why importing the algo proves to be an issue… I’ve tried importing it to my own system and it worked :/
I’ll try and add the code for short positions when I know more about lisamitch’s perspective (and if nobody’s done it before)
Thank you @GraHal, hopefully it’ll generate better profit with more accurate parameters
Morning all.
Well – I think its had a good load of chat great..
Ill try and attach a screenshot of the chart, but not sure if it will be allowed.
Firstly, thank you to all especially BobOgden for all your time on this, the code works for me, but is a loosing code at present.
Secondly, it is a hard one to code i am sure, im not a coder and will probably never be able to code it, Work for god knows how long, home, sort kids out, look at charts, sleep, up to do it all again the next day. I dont even get the weekends off to myself anymore as everyone has either been let go or isolating. So i am immeasurably grateful and thankful for all the efforts going into this.
Thirdly, I do think that this is a profitable strategy (Manual) but the need to automate is because i cant keep getting up at 2am on a wednesday after my PRT system has sent me an email or alarmed to set the trade, its slowly killing me and having to drop kids off at school then go to work is also taking it out of me.
So – Data:
30th September 2020, 1hr Chart (Loaded the code and ran it)
The green candle that it takes a trade on isn’t a pin bar candle, its a full bodied green candle (Normal Candle), so it looks like the strategy is taking trades on the candle thats forming a pinbar, but could then close as a normal candle.
The FIB should show on the candle, then the trade placed on the next candle when it breaks the low of the candle with the FIB on it. See second screenshot (If allowed) where i shall annotate the entry and exit from a trade i took.
I have a few days off at the end of this coming week, so i shall try and create a video and (If allowed) pop a link up to it.
Keep up the great efforts and work guys, and honestly, if you manually trade this, it will make money.
Additional info for the second screenshot:
Wednesday 18th Nov @1500hrs – Pin Bar candle closes. FIB drawn from top to bottom of that candle. Trade set at the same time (Order to enter short) @ 13170.00 (I like rounded up / down numbers) SL (Stop) set to 13220.00, 50 point stop, £3pp trade. Alarm set at 250% FIB at 13108, where i take 75% off and stop moved to BE + 10 points.. Alarm set for 300% and 400% FIB. I closed the rest of the remaining trade at the 400% FIB point @ 13044 for 126.4 point move in total.
The main point is that you DONT enter the trade as the pinbar candle closes, you need to set an order to open a few points below / above the 100% FIB line, that way the trade has a better chance of getting to the 1st target (250% FIB). If you open a trade based on the candle alone, the probability of it being a winner reduces dramatically.
I hope all this makes sense.
Mitch