Highest and Lowest of a number of candles: Programming support
Forums › ProRealTime English forum › ProOrder support › Highest and Lowest of a number of candles: Programming support
- This topic has 13 replies, 3 voices, and was last updated 7 years ago by Juan Salas.
-
-
06/17/2017 at 11:26 AM #38495
Hi everyone,
As you can see, I am new in PRT coding, and I am trying to determine the highest and lowest of the last 16 candles (M15) before 090000 to create a canal, but I don’t really know how to determine these values. I have tried with the function highest and lowest, but I have problems to determine the period from 050000 to 090000. I am feeling embarrassed because it is a simple problem compared to the level of programming I am seeing in the forum, but I would appreciate any help on this.
Thanks in advance,
Best, Juan
06/17/2017 at 12:01 PM #3849806/17/2017 at 6:03 PM #38510Hi Despair,
Thanks for your prompt reply. I am trying to build a very basic system for FOREX in which building a channel (16 candles of 15min) from 050000am to 090000am, and then wait until any candle after 09:00 breaks (with its candles’s close) the inferior (Lowest) or superior limit (Highest), with the idea to scalp 6-8 pips daily.
The problem is that the channel seems to be attached to the price. In other words, that at 09:30, 09:45, 10:00, etc the system is still creating a channel with the previous 16 candles. Either that, or that I don’t know how to limit the number of operations.
I am also trying to limit the operations to 1 a day from 090000 to 140000. But, I don’t know how to limit the entries (long or short) to just one. I have DEFPARAM CumulateORders=False, but the moment that one order is complete, it opens another one.
I know this is too much to ask, but I am stuck here, trying to find the info on the Internet but the only place I receive any answers is here, from either Nicolas or you.
Thanks so much in advance,
Juan
06/17/2017 at 6:31 PM #38512Sending the code, I am sure I have screwed it up.
06/17/2017 at 8:11 PM #38519Hi everyone! Solved the Channel high and low. Thanks Despair. I think I wrote something wrong!!
Just need to solve the one operation per day. Right now, the system launches one buy/sell after another. I would like to buy or sell on the breakout and that is. I am searching on the topics about this subject, so if anyone can redirect me, I would appreciated it.
Thanks!!! 🙂
Juan
06/17/2017 at 8:52 PM #38520Hi guys, someone can help me?
i would say to the TS :
if i am LONG and time >= 020000 and time<= 040000 close the trade if the price is less then lowest of ID pattern (high<high[1] and low>low[1]), if between 020000 and 040000 the condition witn ID pattern does not happened , close the trade at 030000
thanks in advance
Vincenzo
06/17/2017 at 10:57 PM #3852506/18/2017 at 12:23 AM #38529123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051// FOREX BREAKOUT-15 MIN// One order per day, from 09:00h. The system shuts-down at 14:00hDefparam cumulateorders = false//One Trade Per DayOnce nbTrades = 0Once tradesPerDay = 1If Day<>Day[1] thennbTrades = 0ElseIf (Not OnMarket[1] and OnMarket) xor (ShortOnMarket[1] and LongOnMarket) xor (LongOnMarket[1] and ShortOnMarket) thennbTrades = nbTrades + 1EndifEndifIf nbTrades < tradesPerDay then//End One Trade Per Day Code// ConditionsCtime = TIME > 090000 AND TIME < 140000// Range between 0500h to 0900hIF TIME=090000 AND tradeok=1 THENChannelhigh = Highest[16](high)Channellow = Lowest[16](low)ENDIF//No activity if the channel highest and lowest is >= 32 pips and <= 12 pipsIF channelhigh-channellow>=32*pipsize OR channelhigh-channellow<= 12*pipsize THENtradeok = 0ELSEtradeok = 1ENDIF//Conditions for long/short breakout entryIF NOT LONGONMARKET AND Ctime AND tradeok = 1 THENIF close > channelhigh THENBUY 1 CONTRACT AT MARKETENDIFENDIFIF NOT SHORTONMARKET AND Ctime AND tradeok = 1 THENIF close < channellow THENSELLSHORT 1 CONTRACT AT MARKETENDIFENDIFENDIF// Stop y profitSET STOP Loss 8*pipsizeSET TARGET PROFIT 8*pipsizeHi Despair,
I am a little dumb today. I am trying to paste the code here as a text, but I got it in black/white, not coloured/linked as in PRT. My Mac does not convert the itf, and I follow the instructions of <> but it is still b/w. :(((((
As I mentioned, this is my first code. Although I am reading the manuals, there are some specifics that are not mentioned anywhere.
I am trying to build a simple FOREX Breakout system in TF=15′ with a channel from 05:00 to 09:00h, and then wait until the breakout, and wait for the close of the candle breaks the highest or lowest and will launch an order long or short depending the direction at the beginning of next bar. TP=8, SL=8, as you can see it is not very ambitious, but enough to start practising and learning the ropes.
The most important is that I want this to happen just once a day. Once breaks and either win or loss, no more operations for the day. The system will shut-down at 14:00h, which gives plenty of room for one single trade.
Knowing how to program this simple task, will give me the resources to include other features or ideas in the future.
The channel seems to work, although I have been trying to include the limitation of one trade per day, and I might screwed up again.
Any suggestions will be welcome.
I don’t know how to thank you for this!!! Thanks so much. I owe you big.
Juan
06/18/2017 at 11:02 AM #38537Channel Breakout12345678910111213141516171819202122232425262728293031323334353637383940Defparam cumulateorders = false// ConditionsCtime = TIME > 090000 AND TIME < 140000 and not onmarket// Range between 0500h to 0900hIF TIME=090000 THENChannelhigh = Highest[16](high)Channellow = Lowest[16](low)ENDIF//No activity if the channel highest and lowest is >= 32 pips and <= 12 pipsIF channelhigh-channellow>=32*pipsize OR channelhigh-channellow<= 12*pipsize THENnotrade=1ELSEnotrade=0ENDIFIF Ctime and not notrade thenc1=close crosses over channelhighc2=close crosses under channellowIF C1 THENBUY 1 contract at marketnotrade=1ELSIF C2 THENSELLSHORT 1 contract at marketnotrade=1ENDIFENDIFif time= 140000 thenif longonmarket thensell at marketelsif shortonmarket thenexitshort at marketendifendif// Stop y profitSET STOP PLoss 8*pipsizeSET TARGET PPROFIT 8*pipsizeHi Juan,
I think the code above does what you want (I did not test it though). BTW If you prefer me to answer in german, write in the german forum. 🙂
06/18/2017 at 11:22 AM #38538Hi guys, someone can help me? i would say to the TS : if i am LONG and time >= 020000 and time<= 040000 close the trade if the price is less then lowest of ID pattern (high<high[1] and low>low[1]), if between 020000 and 040000 the condition witn ID pattern does not happened , close the trade at 030000 thanks in advance Vincenzo
sorry, i do a correction :
if i am LONG and time >= 020000 and time<= 040000 close the trade if the price is less then lowest of ID pattern (high<high[1] and low>low[1]), if between 020000 and 040000 the condition witn ID pattern does not happened , close the trade at 040000
thanks in advance Vincenzo
06/18/2017 at 11:44 AM #38540Hi Despair,
Thanks a lot for the code and for your effort. I have tested and it seems to be better but all the operations are neutral. I have checked the graphics and all are neutral. And I still launch 2 or 3 buy/sell during the same day.
In any case, thanks so much for your help. I think I can take it from here. I think it just needs some adjustments, and I hope will have by today or tomorrow. I will let you know the result.
BTW, thanks for the German offer, but I am Spanish. Just moved to Hamburg few months ago for family reasons, and I am still have a very basic level of German 🙂
Have a great day!
Juan
06/18/2017 at 12:43 PM #38542Breakout system12345678910111213141516171819202122232425262728293031323334353637383940Defparam cumulateorders = false// ConditionsCtime = TIME > 090000 AND TIME < 140000 and not onmarket// Range between 0500h to 0900hIF TIME=090000 THENChannelhigh = Highest[16](high)Channellow = Lowest[16](low)//No activity if the channel highest and lowest is >= 32 pips and <= 12 pipsIF channelhigh-channellow>=32*pipsize OR channelhigh-channellow<= 12*pipsize THENnotrade=1ELSEnotrade=0ENDIFENDIFIF Ctime and not notrade thenc1=close crosses over channelhighc2=close crosses under channellowIF C1 THENBUY 1 contract at marketnotrade=1ELSIF C2 THENSELLSHORT 1 contract at marketnotrade=1ENDIFENDIFif time= 140000 thenif longonmarket thensell at marketelsif shortonmarket thenexitshort at marketendifendif// Stop y profitSET STOP PLoss 8*pipsizeSET TARGET PPROFIT 8*pipsizeYou are right, the one “endif” was at the wrong place. Now the code shall only take one trade per day.
06/18/2017 at 4:18 PM #38555<pre class=”lang:probuilder decode:true “>// FOREX BREAKOUT
// 15 MIN
// One order per day, from 09:00h. The system shuts-down at 14:00h
// Everyday Channel formation from 0500 to 0900 (Highest-Lowest)
// Maximum-Minimum Channel Amplitude 32pips-12pipsDEFPARAM CUMULATEORDERS = false
// OPERATIONAL TIME
DEFPARAM FLATBEFORE = 090000
DEFPARAM FLATAFTER = 140000
Operationaltime = TIME > 090000 AND TIME < 140000// ONE TRADE PER DAY. It resets the variable each new day
IF INTRADAYBARINDEX = 0 THEN
alreadytraded = 0
ENDIF// RANGE between 0500h to 0900h
IF TIME=090000 THEN
channelhigh = Highest[16](high)
channellow = Lowest[16](low)
ENDIF// NO ACTIVITY if the channel highest and lowest is >= 32 pips and <= 12 pips
IF channelhigh-channellow>=32*pipsize OR channelhigh-channellow<= 12*pipsize THEN
tradeok=0
ELSE
tradeok=1
ENDIF// BREAKOUT Conditions
c1= close > channelhigh
c2= close < channellow// LONG Positions-Opening
IF Operationaltime AND tradeok = 1 AND c1 AND alreadytraded = 0 THEN
BUY 1 CONTRACT AT MARKET
tradeok = 0
alreadytraded = 1
ENDIF// SHORT Positions-Opening
IF Operationaltime AND tradeok = 1 AND c2 AND alreadytraded = 0 THEN
SELLSHORT 1 CONTRACT AT MARKET
tradeok = 0
alreadytraded = 1
ENDIF// STOP & PROFIT
SET STOP LOSS 8*pipsize
SET TARGET PROFIT 8*pipsizeHi Despair,
Now is working perfectly. I have included a different modification that I got from a past post from Nicolas and now only trades once a day.
Thanks so much for your help!!!
Juan
06/18/2017 at 4:21 PM #385561234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// FOREX BREAKOUT// 15 MIN// One order per day, from 09:00h. The system shuts-down at 14:00h// Everyday Channel formation from 0500 to 0900 (Highest-Lowest)// Maximum-Minimum Channel Amplitude 32pips-12pipsDEFPARAM CUMULATEORDERS = false// OPERATIONAL TIMEDEFPARAM FLATBEFORE = 090000DEFPARAM FLATAFTER = 140000Operationaltime = TIME > 090000 AND TIME < 140000// ONE TRADE PER DAY. It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENalreadytraded = 0ENDIF// RANGE between 0500h to 0900hIF TIME=090000 THENchannelhigh = Highest[16](high)channellow = Lowest[16](low)ENDIF// NO ACTIVITY if the channel highest and lowest is >= 32 pips and <= 12 pipsIF channelhigh-channellow>=32*pipsize OR channelhigh-channellow<= 12*pipsize THENtradeok=0ELSEtradeok=1ENDIF// BREAKOUT Conditionsc1= close > channelhighc2= close < channellow// LONG Positions-OpeningIF Operationaltime AND tradeok = 1 AND c1 AND alreadytraded = 0 THENBUY 1 CONTRACT AT MARKETtradeok = 0alreadytraded = 1ENDIF// SHORT Positions-OpeningIF Operationaltime AND tradeok = 1 AND c2 AND alreadytraded = 0 THENSELLSHORT 1 CONTRACT AT MARKETtradeok = 0alreadytraded = 1ENDIF// STOP & PROFITSET STOP LOSS 5*pipsizeSET TARGET PROFIT 10*pipsizeI hope that now is coloured!!! 🙂
-
AuthorPosts
Find exclusive trading pro-tools on