Optimum Entry after Set Point
Forums › ProRealTime English forum › ProOrder support › Optimum Entry after Set Point
- This topic has 9 replies, 3 voices, and was last updated 5 years ago by
Steveaw.
-
-
06/14/2020 at 7:30 PM #135919Optimal Entry after Set Point Reached12345678910111213141516171819202122232425262728293031323334//-------------------------------------------------------------------------// Main code : FX ENTRY SHORT V6// Use Loop System to define hh And better Entry Point//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivateddaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//starttime = 190000// Enter in manually before placing code//endtime = 193000// Enter in manually before placing codeentry = 6540// Manually Entered as a set point after chart analysis//noEntryBeforeTime = 191500//TopofBC = entry +10//conditional loop to determine hhtimeframe (1 minute, updateonclose)//refbar = 0if high > Entry ThenWHILE high > high[1] DO//refbar = barindexhh = high//refbar = refbar + 1ContinueBreakWENDENDIFtimeframe(default, updateonclose)IF not daysForbiddenEntry and not onmarket THENsellshort 1 contract at hh stopENDIF//and time > endtime AND time > noEntrybeforeTime// Stops and targetsSET STOP pLOSS 30SET TARGET pPROFIT tptp=100
Hi all
I’m running round in circles trying to get a code that will trigger an optimal entry after an initial set point. It needs to go something like this (For a Short Position in this case):
- High > = set point (Manually entered into code)
- Once condition at 1 triggered code compares current to previous high in a continuous loop until current high is < previous
- This current high is then the entry point as long as price is still > original set point
Hope this makes sense? I’ve pasted my initial attempt below, but am really struggling to get it to trigger correctly
Your help is much appreciated
06/16/2020 at 10:35 AM #136094Once condition at 1 triggered code compares current to previous high
So you are looking for a retest of a previous high and when you get a retest fail then there is a good chance that price may go down for a while and so a short is a good bet?
Problem is you would need to define HH and retest HH over a certain number of bars and that certain number of bars is not always the same over and over again?
06/16/2020 at 1:11 PM #136124I’d like to make it a bit simpler than that. All I’m looking to do is once my set point has been broken, I’d like to test the high vs previous high in a loop until the high is > than previous high then enter as long as still above my initial set point. hope this makes sense?
Regards
06/16/2020 at 2:18 PM #136135123456HH = High > High[1]HSetPoint = High > XpriceIf HH and HSetPoint ThenBuy at MarketEndifAbove is how I am reading the conditions in your latest post … is that what you mean?
Hey I’m getting worried … it’s starting to seem easier to say stuff in code than in words!! 🙂
06/21/2020 at 12:34 PM #136659Apologies – I’ve been off the screen for a good while so missed your reply!
Thanks for replying and I get what you mean about replying in code, maybe we’re all in the Matrix after all!!
Firstly I do seem to run in to problems as it is very apparent the coding manual I downloaded from PRT Software does not have the complete set of codes and operators, hence I struggle to code what I want my strategies to do! is there a complete set of codes somewhere I am missing?
Back to my original issue.
I think your reply will work, but I still want to run a continuous loop until the condition is true i.e.
- Price is => my set point for the short to trigger the loop (ENTRY)
- A set of conditions i.e. high >high[1]
- Loops until high < high[1]
- Max high within the loop is recored
- Loop stops
- Code enters me into a Short (in this case)
A second condition also need to be added if price doesn’t reverse and keeps on powering up to and/or past x number of pips past my set point for entry. i.e.
I’m guessing an ELSE part of the IF loop:
- high>= ENTRY + 30 (i.e. 30 pips above original set point entry)
- THEN quit i.e. trade is invalid
So to summarise an original set point for entry is entered as a variable within the code, if price = or breaks above the entry level then a loop is initiated until the current high is lower than the previous bar. It loops until this condition is met and then enters as soon as it is.
If it keeps on creating higher highs and breaks above my original set entry point + say 30 pips (variable) the trade is invalid and quits.
Phew! I hope this explains what I am trying to do?
Regards
Steve
06/21/2020 at 1:00 PM #136661is there a complete set of codes somewhere I am missing?
You could try on the link below
https://www.prorealcode.com/prorealtime-documentation/Phew! I hope this explains what I am trying to do?
It be best if @RobertoGozzi or @Vonasi might help you as it’s getting beyond being straight out of my head now! 🙂
1 user thanked author for this post.
06/21/2020 at 1:36 PM #136663As to the very first post the correct code should be (not tested):
12345678910111213141516171819202122232425262728293031//-------------------------------------------------------------------------// Main code : FX ENTRY SHORT V6// Use Loop System to define hh And better Entry Point//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivateddaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//starttime = 190000// Enter in manually before placing code//endtime = 193000// Enter in manually before placing codeentry = 6540// Manually Entered as a set point after chart analysis//noEntryBeforeTime = 191500//TopofBC = entry +10//conditional loop to determine hhtimeframe (1 minute, updateonclose)refbar = 0if high > Entry ThenWHILE high[refbar] >= high[refbar +1] DOhh = highrefbar = refbar + 1WENDENDIFtimeframe(default, updateonclose)IF not daysForbiddenEntry and not onmarket and high > entry THENsellshort 1 contract at hh stopENDIF//and time > endtime AND time > noEntrybeforeTime// Stops and targetsSET STOP pLOSS 30SET TARGET pPROFIT tptp=1001 user thanked author for this post.
06/21/2020 at 6:40 PM #136696Hi
I’ve attached the latest code incorporating your suggestion, but it doesn’t seem to go in below the set point and also increase the reference bar until entry? (it’s for a long entry BTW) again I cannot see wht=y the code will not do this? I’ve also attached a screen shot and for the purposes of the example used the FTSE on 20seconds from 17/06/2020 at 02:29 – set point for entry at 2234 with a stop of 10 PIPs.
Regards
Long Entry Using Loop to establish latest Ref Bar123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// Main code : FX ENTRY LONG T7 - Using Loop condition to Enter//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivateddaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0if onmarket or strategyprofit<>strategyprofit[1] thenflag = 1endifif dayofweek <> dayofweek[1] thenflag = 0endif//breakevenstart=25//pointstokeep=0entry=6234// Set Point for code to start looking for lowest lowBCBot = Entry-sl// If low gets below this level then trade must be invalidated// Stops and targetsSET STOP pLOSS slSET TARGET pPROFIT tpsl = 10tp=50// Conditions to enter long positionnotradetime1=213000notradetime2=233000notradetime=time>notradetime1 and time<notradetime2Starttime = OpenTimeendtime=235900//Set Up Reference Bar & Entry Conditions for a Buy Tradetimeframe (20 seconds, updateonclose)if time > starttime and time <= endtime thenif opentime = starttime thenendifll = lowendifif not longonmarket then//find first new ref bar for long traderefbar = 0if (low <= Entry) AND NOT (low <= BCBot)THEN //first refWHILE low[refbar]<= low[refbar+1] DOll=lowrefbar= refbar + 1ContinueBREAKWENDENDIFendif//determines the highest high & lowest low during the periodif time > starttime then//hh = max(high,hh)ll = min(low,ll)endifIF not daysForbiddenEntry and not flag and not onmarket and not notradetime THENBuy 2 contract at ll limitENDIF06/21/2020 at 6:55 PM #136702Remove lines 47 and 48.
1 user thanked author for this post.
06/21/2020 at 8:03 PM #136709 -
AuthorPosts
Find exclusive trading pro-tools on