need help with coverting a strategy written on Nanotrader
Forums › ProRealTime English forum › ProOrder support › need help with coverting a strategy written on Nanotrader
- This topic has 4 replies, 3 voices, and was last updated 2 days ago by
frilyas.
-
-
12/01/2025 at 12:45 PM #254121
Hello everyone,
I am about to take the plunge and switch mainly to ProRealTime after a long absence from trading. I do not have much experience in coding and automation, and I would like to transfer the tools I used on NanoTrader previously.
For this reason, I need help recoding a strategy that I used on Nanotrader, the express code for which is attached:12/01/2025 at 6:38 PM #254129I slightly modified the title to make it more meaningful for readers.
12/02/2025 at 9:22 AM #254139Hi. Here you have.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222//------------------------------------------// PRC_EL Bullish Breakout// version = 0// 02.12.2025// Iván González @ www.prorealcode.com// Sharing ProRealTime knowledge//------------------------------------------// --- Parameters ---//------------------------------------------Smooth = 3Mini = 4Maxi = 19Prolong = 10MaxHighInclination = 500EntryStrategy = 1//------------------------------------------// --- State Variables ---//------------------------------------------ONCE currentSlope = 0ONCE lineActive = 0ONCE extensionCount = 0// Initialize with Close to avoid visual jumps if used prematurelyONCE lastValidLineVal = Close// ---------------------------------------------------------------------// 1. PIVOT DETECTION// ---------------------------------------------------------------------isPivot = 0pivotBar = 0pivotPrice = 0// Detection logic based on 'Smooth' parameterIF Smooth = 1 THENIF High[1] >= High[2] AND High[1] > High THENisPivot = 1pivotBar = BarIndex[1]pivotPrice = High[1]ENDIFELSIF Smooth = 2 THENIF High[2] >= High[3] AND High[2] >= High[4] AND High[2] > High[1] AND High[2] > High THENisPivot = 1pivotBar = BarIndex[2]pivotPrice = High[2]ENDIFELSIF Smooth = 3 THENIF High[3] >= High[4] AND High[3] >= High[5] AND High[3] >= High[6] AND High[3] > High[2] AND High[3] > High[1] AND High[3] > High THENisPivot = 1pivotBar = BarIndex[3]pivotPrice = High[3]ENDIFENDIF// Manage the simulated pivot array (FIFO)IF isPivot = 1 THENH5 = H4BarH5 = BarH4H4 = H3BarH4 = BarH3H3 = H2BarH3 = BarH2H2 = H1BarH2 = BarH1H1 = pivotPriceBarH1 = pivotBar// When a new pivot is found, reset active search to re-evaluatelineActive = 0ENDIF// ---------------------------------------------------------------------// 2. LINE CALCULATION AND VALIDATION// ---------------------------------------------------------------------isValidLine = 0chosenH = 0chosenBarH = 0finalSlope = 0// Only process if there is a new pivot H1 and an existing historical H2IF isPivot = 1 AND H2 > 0 THEN// --- Attempt 1: Connect H1 with H2 ---distH2 = BarH1 - BarH2IF distH2 >= Mini AND distH2 <= Maxi AND H2 >= H1 THENtempSlope = (H1 - H2) / distH2isClean = 1// Cleanliness validation (no intermediate candle crosses the line)FOR i = 1 TO (distH2 - 1) DO// Calculate theoretical line price in the pasttheoreticalPrice = H2 + (tempSlope * i)// Index of the candle to check (from H2 moving forward)checkIndexOffset = (BarIndex - BarH2) - iIF High[checkIndexOffset] > theoreticalPrice THENisClean = 0BREAKENDIFNEXT// Slope validation (x100000 to normalize FX/Indices scale)slopeFactor = (tempSlope * 100000) / ClosevalidSlope = 0IF slopeFactor <= MaxHighInclination THENvalidSlope = 1ENDIFIF isClean = 1 AND validSlope = 1 THENisValidLine = 1chosenH = H2chosenBarH = BarH2finalSlope = tempSlopeENDIFENDIF// --- Attempt 2: Connect H1 with H3 (if H2 failed) ---IF isValidLine = 0 AND H3 > 0 THENdistH3 = BarH1 - BarH3IF distH3 >= Mini AND distH3 <= Maxi AND H3 >= H1 THENtempSlope = (H1 - H3) / distH3isClean = 1FOR i = 1 TO (distH3 - 1) DOtheoreticalPrice = H3 + (tempSlope * i)checkIndexOffset = (BarIndex - BarH3) - iIF High[checkIndexOffset] > theoreticalPrice THENisClean = 0BREAKENDIFNEXTslopeFactor = (tempSlope * 100000) / ClosevalidSlope = 0IF slopeFactor <= MaxHighInclination THENvalidSlope = 1ENDIFIF isClean = 1 AND validSlope = 1 THENisValidLine = 1chosenH = H3chosenBarH = BarH3finalSlope = tempSlopeENDIFENDIFENDIF// --------------------------------------------------------// START PROJECTION// --------------------------------------------------------IF isValidLine = 1 THENcurrentSlope = finalSlopelineActive = 1extensionCount = Prolong// 1. Draw Solid Line (History)DRAWSEGMENT(chosenBarH, chosenH, BarH1, H1) COLOURED(0,0,0) STYLE(line, 2)// 2. Fill the "Lag" gap from Smooth parametercurrentDist = BarIndex - BarH1currentResVal = H1 + (currentSlope * currentDist)// Draw the first dotted segment from Pivot H1 to RIGHT NOWDRAWSEGMENT(BarH1, H1, BarIndex, currentResVal) COLOURED(0, 200, 0) STYLE(dottedline, 2)// 3. Initialize the value for the NEXT candlelastValidLineVal = currentResValENDIFENDIF// ---------------------------------------------------------------------// 3. CONTINUOUS PROJECTION DRAWING AND SIGNALS// ---------------------------------------------------------------------buySignal = 0resValue = 0// Only enter here if line is active AND it is NOT the candle where we just detected the pivotIF lineActive = 1 AND extensionCount > 0 AND isPivot = 0 THEN// Step-by-step projection (Previous candle -> Current candle)resValue = lastValidLineVal + currentSlope// Draw continuous projectionDRAWSEGMENT(BarIndex[1], lastValidLineVal, BarIndex, resValue) COLOURED(0, 200, 0) STYLE(dottedline, 2)// Update for the futurelastValidLineVal = resValue// Breakout Entry LogicisBreakout = 0IF EntryStrategy = 1 THEN// Close crosses overIF Close CROSSES OVER resValue THENisBreakout = 1ENDIFELSIF EntryStrategy = 2 THEN// High crosses over and Close is higherIF High CROSSES OVER resValue AND Close > resValue THENisBreakout = 1ENDIFENDIFIF isBreakout = 1 THENbuySignal = 1// Disable line after breakoutlineActive = 0// Draw visual signalDRAWARROWUP(BarIndex, Low - AverageTrueRange[14](Close)) COLOURED(0, 155, 0)ENDIF// Decrease candle counterextensionCount = extensionCount - 1IF extensionCount = 0 THENlineActive = 0ENDIFENDIFRETURN1 user thanked author for this post.
12/03/2025 at 1:53 PM #254210Hello, Ivan,
I really want to thank you, you are really nice.
Please accept the gratitude of an old man who has just arrived from the world of Nanotrader and is embarking on the ProRealTime journey, but who is not very good at coding and programming, especially with ProBuilder.
I used a lot of tools available on NanoTrader that I would like to find on ProRealTime.
Thank you again.
Kind regards,1 user thanked author for this post.
12/03/2025 at 1:55 PM #254212The same goes for robertogozzi; thank you too.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on 