/*[[ Name := TrendCreator Author := Copyright © 2002, Company Link := http://www.company.com/ Notes := Create trend points Update on every tick := No Enable Alerts := No Disable alert once hit := No Lots := 1 Stop Loss := 0 Take Profit := 0 Trailing Stop := 0 ]]*/ Define: nPoints(3); // count of points to be found Define: nBars(3); // minimum bars left/right Variable: nCurrentHi(0), nCurrentBar(0), nCurrentCheck(1), nDirection(1); // current Relative High Variable: lOk(False), lOkDirection(False); // current RH has been found Variable: i(1), i1(1), iRLH(1); Define: lStop(1); Define: nSymbolHi(242), nSymbolLow(241); If lStop=1 Then exit; lStop = 1; Print("------------------"); // find RHs and RLs For iRLH = 1 to 2 { nCurrentBar = 0; nDirection = 1; For i=1 to nPoints { nCurrentBar = nCurrentBar + nBars + 1; // begining bar from which looking for RH will start nDirection = -1; // direction to compare (-1 forward, 1 back) lOk = False; If nCurrentBar >= Bars Then { Print("End of trend creating..."); }; Print("Point ", i); While lOK != True { // compare bars If iRLH = 1 Then nCurrentHi = High[nCurrentBar] Else nCurrentHi = Low[nCurrentBar]; nCurrentCheck = nCurrentBar; For i1=1 to nBars { nCurrentCheck = nCurrentCheck + nDirection; If iRLH = 1 Then Print("***HIGH*** nCurrentCheck ", nCurrentCheck, " ", High[nCurrentCheck], " nCurrentBar ", nCurrentBar, " nCurrentHi ", nCurrentHi) Else Print("***LOW*** nCurrentCheck ", nCurrentCheck, " ", Low[nCurrentCheck], " nCurrentBar ", nCurrentBar, " nCurrentHi ", nCurrentHi); If (High[nCurrentCheck]>nCurrentHi and iRLH=1) or (Low[nCurrentCheck]