<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[QChartist Forum - All Forums]]></title>
		<link>https://www.qchartist.net/forum/</link>
		<description><![CDATA[QChartist Forum - https://www.qchartist.net/forum]]></description>
		<pubDate>Sat, 11 Apr 2026 13:06:09 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Happy new year]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=2368</link>
			<pubDate>Sat, 03 Jan 2026 13:28:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=2368</guid>
			<description><![CDATA[After more than 15 years of hard work, 2026 was a pivotal year for me, where i turned from looser to winner.<br />
Cheers]]></description>
			<content:encoded><![CDATA[After more than 15 years of hard work, 2026 was a pivotal year for me, where i turned from looser to winner.<br />
Cheers]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Proper analysis of the trend and patience are keys]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1502</link>
			<pubDate>Thu, 28 Aug 2025 12:52:30 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1502</guid>
			<description><![CDATA[The lesson I’d like to teach you today is that when you are confident about the trend over a good period of time, thanks to spectral analysis and other powerful indicators, even if your positions fall into the red for a while, don’t cut your losses! That negative period is nothing more than whipsaws and dips within the positive trend you identified at the start. Don’t get discouraged and don’t liquidate your positions, especially if you’ve taken on low leverage. Be patient and wait for it to turn positive again — your competitors in the market are just trying to play with your nerves. It’s a game of patience, and in the end, the most patient one wins!]]></description>
			<content:encoded><![CDATA[The lesson I’d like to teach you today is that when you are confident about the trend over a good period of time, thanks to spectral analysis and other powerful indicators, even if your positions fall into the red for a while, don’t cut your losses! That negative period is nothing more than whipsaws and dips within the positive trend you identified at the start. Don’t get discouraged and don’t liquidate your positions, especially if you’ve taken on low leverage. Be patient and wait for it to turn positive again — your competitors in the market are just trying to play with your nerves. It’s a game of patience, and in the end, the most patient one wins!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[64 bit version of QChartist]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1500</link>
			<pubDate>Sun, 24 Aug 2025 14:22:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1500</guid>
			<description><![CDATA[Hello, I plan to rewrite a pure 64 bit C/C++ version of QChartist using QT Creator for the GUI.<br />
I think this is the best option that will allow to make it cross os, making the app compatible with all os (mobile or desktop)<br />
If you are a good programmer and interested to help me to build this project, please reply to this message or contact us.<br />
Thank you]]></description>
			<content:encoded><![CDATA[Hello, I plan to rewrite a pure 64 bit C/C++ version of QChartist using QT Creator for the GUI.<br />
I think this is the best option that will allow to make it cross os, making the app compatible with all os (mobile or desktop)<br />
If you are a good programmer and interested to help me to build this project, please reply to this message or contact us.<br />
Thank you]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Spectrometer Hurst and FFT]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1487</link>
			<pubDate>Wed, 13 Aug 2025 13:06:28 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1487</guid>
			<description><![CDATA[First find a good signal with the System #4 QChartist's Magic Hat Trick System<br />
<br />
Then here is an idea to confirm the entry :<br />
<br />
Yes — combining a <span style="font-weight: bold;" class="mycode_b">Fast Fourier Transform (FFT)</span> with the <span style="font-weight: bold;" class="mycode_b">Hurst Cycles Spectrometer</span> can be more powerful than using either one alone, but they serve slightly different roles:<br />
<span style="font-weight: bold;" class="mycode_b">1. What FFT brings to the table</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Broad-spectrum detection</span> – FFT quickly identifies all periodic components in data, even weak ones, over a wide frequency range.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mathematically rigorous</span> – It decomposes the signal into precise sine and cosine waves, giving clear frequency peaks.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Fast computation</span> – You can process large datasets quickly and spot new cycle candidates.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">2. What Hurst’s method adds</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Market-specific filtering</span> – Hurst's approach is tailored to financial series, which are noisy and non-stationary, so it focuses on cycles that actually persist and matter for trading.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Phase and translation to trading context</span> – It ties cycles to timing models, peak-trough forecasts, and “nominal model” cycle families.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Noise suppression</span> – It tends to filter out meaningless peaks that FFT might still show.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">3. Why combining them works</span><ul class="mycode_list"><li>Use <span style="font-weight: bold;" class="mycode_b">FFT</span> as a <span style="font-style: italic;" class="mycode_i">scouting tool</span> to identify candidate dominant frequencies.<br />
</li>
<li>Feed these frequencies into <span style="font-weight: bold;" class="mycode_b">Hurst’s spectrometer</span> for deeper analysis, smoothing, and validation against price action.<br />
</li>
<li>This two-step approach reduces false positives and gives both mathematical rigor and market relevance.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">4. Potential workflow</span><br />
<ol type="1" class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">FFT Stage</span> – Run FFT on your price data → note the strongest frequency peaks.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Hurst Stage</span> – Use those frequencies as starting points → refine them, track amplitude and phase over time, integrate into trading cycle forecasts.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Feedback loop</span> – Re-run FFT periodically to catch emerging cycles and retire fading ones.<br />
</li>
</ol>
If you like, I can sketch out a <span style="font-style: italic;" class="mycode_i">practical hybrid FFT + Hurst workflow</span> so you can see exactly how the steps fit together for trading cycle analysis.<br />
<br />
If your <span style="font-weight: bold;" class="mycode_b">FFT</span> and <span style="font-weight: bold;" class="mycode_b">Hurst Cycles Spectrometer</span> outputs are <span style="font-weight: bold;" class="mycode_b">synchronized</span>—meaning they both highlight the <span style="font-style: italic;" class="mycode_i">same</span> dominant cycle lengths at the <span style="font-style: italic;" class="mycode_i">same</span> time—that’s a pretty strong signal in cycle analysis.<br />
Here’s why:<br />
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">1. Higher confidence in the cycle</span><ul class="mycode_list"><li>FFT is purely mathematical: it doesn’t “care” about market theory—it just decomposes data into sinusoidal components.<br />
</li>
<li>Hurst’s spectrometer is market-aware and noise-tolerant, looking for persistent cycles.<br />
</li>
<li>When <span style="font-style: italic;" class="mycode_i">both</span> agree, it suggests the cycle is not just a random spike in the spectrum but a <span style="font-style: italic;" class="mycode_i">structurally persistent</span> rhythm in the market.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">2. More reliable timing</span><ul class="mycode_list"><li>FFT alone can’t tell you <span style="font-style: italic;" class="mycode_i">where</span> in the cycle you are—it only identifies frequencies.<br />
</li>
<li>Hurst’s method tracks phase (peak/trough positions), giving actionable timing.<br />
</li>
<li>Synchronization means your frequency detection and your phase model are aligned, so your turning-point forecasts are more trustworthy.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">3. Reduced false positives</span><ul class="mycode_list"><li>FFT can be fooled by transient noise patterns.<br />
</li>
<li>Hurst can be biased by pre-set “nominal cycle” expectations.<br />
</li>
<li>When they independently lock onto the same cycle, the chance that it’s noise drops significantly.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">4. Potential trading edge</span><ul class="mycode_list"><li>You can trade <span style="font-style: italic;" class="mycode_i">with</span> the cycle’s rhythm, entering near troughs and exiting near peaks with greater conviction.<br />
</li>
<li>You might also size positions more aggressively when both methods agree, since the statistical edge is higher.<br />
</li>
</ul>
<hr class="mycode_hr" />
In practice, people often set up something like:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">FFT Spectrum</span> → watch for strong peaks that persist for several bars of data.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Hurst Analysis</span> → see if it confirms the same cycle length and shows favorable phase for entry.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Trade Filter</span> → only act when both are in sync, plus price action agrees.<br />
</li>
</ul>
<hr class="mycode_hr" />
If you want, I can outline exactly <span style="font-weight: bold;" class="mycode_b">how to run and sync these two analyses in a single charting workflow</span> so they reinforce each other in real time. That’s where the real power comes in.<br />
<br />
Both indicators are available for QChartist (separate canvas)]]></description>
			<content:encoded><![CDATA[First find a good signal with the System #4 QChartist's Magic Hat Trick System<br />
<br />
Then here is an idea to confirm the entry :<br />
<br />
Yes — combining a <span style="font-weight: bold;" class="mycode_b">Fast Fourier Transform (FFT)</span> with the <span style="font-weight: bold;" class="mycode_b">Hurst Cycles Spectrometer</span> can be more powerful than using either one alone, but they serve slightly different roles:<br />
<span style="font-weight: bold;" class="mycode_b">1. What FFT brings to the table</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Broad-spectrum detection</span> – FFT quickly identifies all periodic components in data, even weak ones, over a wide frequency range.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mathematically rigorous</span> – It decomposes the signal into precise sine and cosine waves, giving clear frequency peaks.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Fast computation</span> – You can process large datasets quickly and spot new cycle candidates.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">2. What Hurst’s method adds</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Market-specific filtering</span> – Hurst's approach is tailored to financial series, which are noisy and non-stationary, so it focuses on cycles that actually persist and matter for trading.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Phase and translation to trading context</span> – It ties cycles to timing models, peak-trough forecasts, and “nominal model” cycle families.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Noise suppression</span> – It tends to filter out meaningless peaks that FFT might still show.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">3. Why combining them works</span><ul class="mycode_list"><li>Use <span style="font-weight: bold;" class="mycode_b">FFT</span> as a <span style="font-style: italic;" class="mycode_i">scouting tool</span> to identify candidate dominant frequencies.<br />
</li>
<li>Feed these frequencies into <span style="font-weight: bold;" class="mycode_b">Hurst’s spectrometer</span> for deeper analysis, smoothing, and validation against price action.<br />
</li>
<li>This two-step approach reduces false positives and gives both mathematical rigor and market relevance.<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">4. Potential workflow</span><br />
<ol type="1" class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">FFT Stage</span> – Run FFT on your price data → note the strongest frequency peaks.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Hurst Stage</span> – Use those frequencies as starting points → refine them, track amplitude and phase over time, integrate into trading cycle forecasts.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Feedback loop</span> – Re-run FFT periodically to catch emerging cycles and retire fading ones.<br />
</li>
</ol>
If you like, I can sketch out a <span style="font-style: italic;" class="mycode_i">practical hybrid FFT + Hurst workflow</span> so you can see exactly how the steps fit together for trading cycle analysis.<br />
<br />
If your <span style="font-weight: bold;" class="mycode_b">FFT</span> and <span style="font-weight: bold;" class="mycode_b">Hurst Cycles Spectrometer</span> outputs are <span style="font-weight: bold;" class="mycode_b">synchronized</span>—meaning they both highlight the <span style="font-style: italic;" class="mycode_i">same</span> dominant cycle lengths at the <span style="font-style: italic;" class="mycode_i">same</span> time—that’s a pretty strong signal in cycle analysis.<br />
Here’s why:<br />
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">1. Higher confidence in the cycle</span><ul class="mycode_list"><li>FFT is purely mathematical: it doesn’t “care” about market theory—it just decomposes data into sinusoidal components.<br />
</li>
<li>Hurst’s spectrometer is market-aware and noise-tolerant, looking for persistent cycles.<br />
</li>
<li>When <span style="font-style: italic;" class="mycode_i">both</span> agree, it suggests the cycle is not just a random spike in the spectrum but a <span style="font-style: italic;" class="mycode_i">structurally persistent</span> rhythm in the market.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">2. More reliable timing</span><ul class="mycode_list"><li>FFT alone can’t tell you <span style="font-style: italic;" class="mycode_i">where</span> in the cycle you are—it only identifies frequencies.<br />
</li>
<li>Hurst’s method tracks phase (peak/trough positions), giving actionable timing.<br />
</li>
<li>Synchronization means your frequency detection and your phase model are aligned, so your turning-point forecasts are more trustworthy.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">3. Reduced false positives</span><ul class="mycode_list"><li>FFT can be fooled by transient noise patterns.<br />
</li>
<li>Hurst can be biased by pre-set “nominal cycle” expectations.<br />
</li>
<li>When they independently lock onto the same cycle, the chance that it’s noise drops significantly.<br />
</li>
</ul>
<hr class="mycode_hr" />
<span style="font-weight: bold;" class="mycode_b">4. Potential trading edge</span><ul class="mycode_list"><li>You can trade <span style="font-style: italic;" class="mycode_i">with</span> the cycle’s rhythm, entering near troughs and exiting near peaks with greater conviction.<br />
</li>
<li>You might also size positions more aggressively when both methods agree, since the statistical edge is higher.<br />
</li>
</ul>
<hr class="mycode_hr" />
In practice, people often set up something like:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">FFT Spectrum</span> → watch for strong peaks that persist for several bars of data.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Hurst Analysis</span> → see if it confirms the same cycle length and shows favorable phase for entry.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Trade Filter</span> → only act when both are in sync, plus price action agrees.<br />
</li>
</ul>
<hr class="mycode_hr" />
If you want, I can outline exactly <span style="font-weight: bold;" class="mycode_b">how to run and sync these two analyses in a single charting workflow</span> so they reinforce each other in real time. That’s where the real power comes in.<br />
<br />
Both indicators are available for QChartist (separate canvas)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Include new c++ library flags in the compilation]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1486</link>
			<pubDate>Wed, 13 Aug 2025 07:17:13 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1486</guid>
			<description><![CDATA[Hello everybody, <br />
<br />
i use the RQPC RapidQ Pre Compiler from Jacques and i compile C++ code in my RapidQ program.<br />
But the problem is that i don't know how to link new libraries (flags) for the mingw G++ compiler that is used by RQPC.<br />
For example if i want to link C++ OpenGL library in need to use the -lGL flag with G++<br />
Can anybody add this functionality to RQPC that will allow to use custom flags for the compiler, this would help me a lot for example to use python code in my RapidQ programs. Jacques didn't share the source code of his RQPC unfortunately.<br />
<br />
Thank you for your help!<br />
<br />
In fact, to run a python code, i want to link the python library to g++, include my python code to example.cpp <br />
#include "Python.h"<br />
Py_Initialize();<br />
and so on....<br />
and then use rqpc to compile example.bas with example.cpp<br />
compile example: g++ art_wrapper.c main.cpp -o main -lpython2.8<br />
I know this is technically possible, so that i can use values of the variables of my python calculations directly in my rapidq.bas program<br />
But to do that rqpc should be able to accept the option to include custom libraries to link with g++ (-lpython2.8)<br />
<br />
I found a way to do what i want without modifying rqpc but it's a bit tricky.<br />
For the moment, the only workaround i found is to rename g++ to g++2.exe and create a new g++ executable that will collect the command line arguments of itself (after %0 (g++ itself)) and that will execute g++2.exe with all the collected arguments + -lpython2.8<br />
Then, when RQPC will call g++, g++2 (the original file) will be executed with the new flag -lpython2.8<br />
<br />
Hello Jacques, thank you for your code of the g++.bat<br />
I managed to make it work !<br />
<br />
In fact RQPC needs a g++.exe so i had to convert my g++.bat to g++.exe with a bat2exe converter<br />
<br />
I found this converter which works fine : <a href="https://github.com/tokyoneon/B2E" target="_blank" rel="noopener" class="mycode_url">https://github.com/tokyoneon/B2E</a><br />
<a href="https://qchartist.net/files/utils/Bat_To_Exe_Converter.zip" target="_blank" rel="noopener" class="mycode_url">https://qchartist.net/files/utils/Bat_To...verter.zip</a><br />
<br />
My g++.bat for example contains this line : <br />
c:\myprogram\mingw\bin\g++2.exe %* -lopengl32 -lglu32 -lglut<br />
rem So we add opengl C++ support to our RapidQ program <img src="https://www.qchartist.net/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /><br />
<br />
i rename the original g++.exe to g++2.exe and<br />
i create a g++.exe with the B2E tool from my g++.bat<br />
<br />
myprogram.bas contains the rapidq code:<br />
''pre cmd FBVERSION=017 FBLANG=deprecated run enc noopt exe con NoDone icon myprogram.ico kill includes\cppincludes.cpp<br />
''pre end<br />
'Compiler Directives<br />
&#36;APPTYPE console 'GUI<br />
&#36;OPTIMIZE on<br />
&#36;TYPECHECK on<br />
dim cpptmpfuncreturn as string<br />
myvar = VAL(mytext.Text)<br />
defstr myvarstr=str&#36;(myvar):cpptmpfuncreturn=varptr&#36;(setsomething(varptr(myvarstr))) ' we interact with c++ this way<br />
and so on...<br />
<br />
includes\cppincludes.cpp contains the c++ source code of our opengl program to include to our rapidq myprogram.bas :<br />
// ''RQEXPORT function setsomething(parameter)<br />
#include "includes\myopenglprogram.cpp"<br />
<br />
then i compile my program with<br />
rqpc\rqpc myprogram.bas<br />
<br />
bingo]]></description>
			<content:encoded><![CDATA[Hello everybody, <br />
<br />
i use the RQPC RapidQ Pre Compiler from Jacques and i compile C++ code in my RapidQ program.<br />
But the problem is that i don't know how to link new libraries (flags) for the mingw G++ compiler that is used by RQPC.<br />
For example if i want to link C++ OpenGL library in need to use the -lGL flag with G++<br />
Can anybody add this functionality to RQPC that will allow to use custom flags for the compiler, this would help me a lot for example to use python code in my RapidQ programs. Jacques didn't share the source code of his RQPC unfortunately.<br />
<br />
Thank you for your help!<br />
<br />
In fact, to run a python code, i want to link the python library to g++, include my python code to example.cpp <br />
#include "Python.h"<br />
Py_Initialize();<br />
and so on....<br />
and then use rqpc to compile example.bas with example.cpp<br />
compile example: g++ art_wrapper.c main.cpp -o main -lpython2.8<br />
I know this is technically possible, so that i can use values of the variables of my python calculations directly in my rapidq.bas program<br />
But to do that rqpc should be able to accept the option to include custom libraries to link with g++ (-lpython2.8)<br />
<br />
I found a way to do what i want without modifying rqpc but it's a bit tricky.<br />
For the moment, the only workaround i found is to rename g++ to g++2.exe and create a new g++ executable that will collect the command line arguments of itself (after %0 (g++ itself)) and that will execute g++2.exe with all the collected arguments + -lpython2.8<br />
Then, when RQPC will call g++, g++2 (the original file) will be executed with the new flag -lpython2.8<br />
<br />
Hello Jacques, thank you for your code of the g++.bat<br />
I managed to make it work !<br />
<br />
In fact RQPC needs a g++.exe so i had to convert my g++.bat to g++.exe with a bat2exe converter<br />
<br />
I found this converter which works fine : <a href="https://github.com/tokyoneon/B2E" target="_blank" rel="noopener" class="mycode_url">https://github.com/tokyoneon/B2E</a><br />
<a href="https://qchartist.net/files/utils/Bat_To_Exe_Converter.zip" target="_blank" rel="noopener" class="mycode_url">https://qchartist.net/files/utils/Bat_To...verter.zip</a><br />
<br />
My g++.bat for example contains this line : <br />
c:\myprogram\mingw\bin\g++2.exe %* -lopengl32 -lglu32 -lglut<br />
rem So we add opengl C++ support to our RapidQ program <img src="https://www.qchartist.net/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /><br />
<br />
i rename the original g++.exe to g++2.exe and<br />
i create a g++.exe with the B2E tool from my g++.bat<br />
<br />
myprogram.bas contains the rapidq code:<br />
''pre cmd FBVERSION=017 FBLANG=deprecated run enc noopt exe con NoDone icon myprogram.ico kill includes\cppincludes.cpp<br />
''pre end<br />
'Compiler Directives<br />
&#36;APPTYPE console 'GUI<br />
&#36;OPTIMIZE on<br />
&#36;TYPECHECK on<br />
dim cpptmpfuncreturn as string<br />
myvar = VAL(mytext.Text)<br />
defstr myvarstr=str&#36;(myvar):cpptmpfuncreturn=varptr&#36;(setsomething(varptr(myvarstr))) ' we interact with c++ this way<br />
and so on...<br />
<br />
includes\cppincludes.cpp contains the c++ source code of our opengl program to include to our rapidq myprogram.bas :<br />
// ''RQEXPORT function setsomething(parameter)<br />
#include "includes\myopenglprogram.cpp"<br />
<br />
then i compile my program with<br />
rqpc\rqpc myprogram.bas<br />
<br />
bingo]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Broker migration]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1483</link>
			<pubDate>Thu, 07 Aug 2025 15:16:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1483</guid>
			<description><![CDATA[As Kucoin is currently under regulatory restrictions that impact their customers like us, we decided to move from KuCoin to Hyperliquid to continue our trading activities.<br />
<br />
We regret to quit Kucoin because it was good as they have plenty of coins available, and now with Hyperliquid, we are limited to about 174 perp futures pairs. But that's how it is and we will try to do our best to make stable, regular and long term profits with Hyperliquid ; that we redistribute to the community.<br />
<br />
All the best,<br />
Cheers]]></description>
			<content:encoded><![CDATA[As Kucoin is currently under regulatory restrictions that impact their customers like us, we decided to move from KuCoin to Hyperliquid to continue our trading activities.<br />
<br />
We regret to quit Kucoin because it was good as they have plenty of coins available, and now with Hyperliquid, we are limited to about 174 perp futures pairs. But that's how it is and we will try to do our best to make stable, regular and long term profits with Hyperliquid ; that we redistribute to the community.<br />
<br />
All the best,<br />
Cheers]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[You shouldn't try to teach something you haven't truly mastered.]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1468</link>
			<pubDate>Wed, 30 Jul 2025 16:06:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1468</guid>
			<description><![CDATA[You shouldn't try to teach something you haven't truly mastered.<br />
Exactly. You're touching on a fundamental rule of intellectual integrity:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>You can only teach well what you truly understand — and ideally, what you’ve personally experienced.</blockquote>
<hr class="mycode_hr" />
Why this principle is crucial in trading (and beyond):<br />
1. Real-world experience = the only true authority<br />
Theory can be learned from books.<br />
But in trading, it's the lived experience of losses, doubt, and discipline under pressure that builds real skill.<br />
Without that, you're just teaching emptiness — or worse, illusions.<br />
<hr class="mycode_hr" />
2. The consequences are real — for others<br />
When someone follows a strategy they believe is reliable and loses money because of an incompetent “expert,” it’s not harmless.<br />
It leads to:<ul class="mycode_list"><li>financial losses<br />
</li>
<li>loss of trust<br />
</li>
<li>sometimes psychological damage<br />
</li>
</ul>
<hr class="mycode_hr" />
3. Business over teaching = common drift<br />
In the world of trading, many people teach to make a living — but would stop teaching if they were truly profitable themselves.<br />
It’s a twisted dynamic:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>People sell a skill they haven’t proven in real life — which would be unacceptable in any other profession.</blockquote>
<hr class="mycode_hr" />
In short:<br />
You’re absolutely right to call it out:<br />
<span style="font-weight: bold;" class="mycode_b">Teaching without mastery is posturing, not knowledge.</span><br />
And in a field as risky as trading, it’s not just misleading — it’s dangerous.<br />
If you’d like, I can help you identify trustworthy sources or people who teach with <span style="font-weight: bold;" class="mycode_b">transparency and proven results</span> — though they’re rare and often less visible than the dream-sellers.]]></description>
			<content:encoded><![CDATA[You shouldn't try to teach something you haven't truly mastered.<br />
Exactly. You're touching on a fundamental rule of intellectual integrity:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>You can only teach well what you truly understand — and ideally, what you’ve personally experienced.</blockquote>
<hr class="mycode_hr" />
Why this principle is crucial in trading (and beyond):<br />
1. Real-world experience = the only true authority<br />
Theory can be learned from books.<br />
But in trading, it's the lived experience of losses, doubt, and discipline under pressure that builds real skill.<br />
Without that, you're just teaching emptiness — or worse, illusions.<br />
<hr class="mycode_hr" />
2. The consequences are real — for others<br />
When someone follows a strategy they believe is reliable and loses money because of an incompetent “expert,” it’s not harmless.<br />
It leads to:<ul class="mycode_list"><li>financial losses<br />
</li>
<li>loss of trust<br />
</li>
<li>sometimes psychological damage<br />
</li>
</ul>
<hr class="mycode_hr" />
3. Business over teaching = common drift<br />
In the world of trading, many people teach to make a living — but would stop teaching if they were truly profitable themselves.<br />
It’s a twisted dynamic:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>People sell a skill they haven’t proven in real life — which would be unacceptable in any other profession.</blockquote>
<hr class="mycode_hr" />
In short:<br />
You’re absolutely right to call it out:<br />
<span style="font-weight: bold;" class="mycode_b">Teaching without mastery is posturing, not knowledge.</span><br />
And in a field as risky as trading, it’s not just misleading — it’s dangerous.<br />
If you’d like, I can help you identify trustworthy sources or people who teach with <span style="font-weight: bold;" class="mycode_b">transparency and proven results</span> — though they’re rare and often less visible than the dream-sellers.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[QChartist DAO – Powered by Performance, Rewarded in Crypto]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1463</link>
			<pubDate>Wed, 23 Jul 2025 13:57:30 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1463</guid>
			<description><![CDATA[QChartist Community Profit Sharing Initiative<br />
<br />
QChartist DAO - To create a transparent and decentralized financial ecosystem where the profits generated by QChartist TA’s trading operations are redistributed to the community in the form of QCH tokens or well-established cryptocurrencies such as TRX (Tron), LTC, or BCH.<br />
<br />
QChartist DAO - QChartist DAO introduces a profit-sharing model that rewards its community members regularly, based on real trading profits and token economics.<br />
<br />
Multi-token payouts: Members receive allocations in QCH or major altcoins, ensuring flexibility and real-world value. Solana-based QCH token: Fast, cheap Hybrid reward model: Combines QCH with external crypto liquidity. No need to trade:Holders earn passively from the team’s performance.<br />
<br />
The QChartist TA team actively trades the markets. A share of monthly/weekly profits is converted to QCH, TRX, LTC, or BCH. Tokens are redistributed to users via airdrops. Users can stake, hold, or trade their tokens freely.<br />
<br />
Intro : <a href="https://www.qchartist.net/blog/qchartist-dao-powered-by-performance-rewarded-in-crypto/" target="_blank" rel="noopener" class="mycode_url">https://www.qchartist.net/blog/qchartist...in-crypto/</a><br />
Join us : <a href="https://www.qchartist.net/exchange/register.php" target="_blank" rel="noopener" class="mycode_url">https://www.qchartist.net/exchange/register.php</a>]]></description>
			<content:encoded><![CDATA[QChartist Community Profit Sharing Initiative<br />
<br />
QChartist DAO - To create a transparent and decentralized financial ecosystem where the profits generated by QChartist TA’s trading operations are redistributed to the community in the form of QCH tokens or well-established cryptocurrencies such as TRX (Tron), LTC, or BCH.<br />
<br />
QChartist DAO - QChartist DAO introduces a profit-sharing model that rewards its community members regularly, based on real trading profits and token economics.<br />
<br />
Multi-token payouts: Members receive allocations in QCH or major altcoins, ensuring flexibility and real-world value. Solana-based QCH token: Fast, cheap Hybrid reward model: Combines QCH with external crypto liquidity. No need to trade:Holders earn passively from the team’s performance.<br />
<br />
The QChartist TA team actively trades the markets. A share of monthly/weekly profits is converted to QCH, TRX, LTC, or BCH. Tokens are redistributed to users via airdrops. Users can stake, hold, or trade their tokens freely.<br />
<br />
Intro : <a href="https://www.qchartist.net/blog/qchartist-dao-powered-by-performance-rewarded-in-crypto/" target="_blank" rel="noopener" class="mycode_url">https://www.qchartist.net/blog/qchartist...in-crypto/</a><br />
Join us : <a href="https://www.qchartist.net/exchange/register.php" target="_blank" rel="noopener" class="mycode_url">https://www.qchartist.net/exchange/register.php</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[QChartist Technical Analysis Charting Software: Can AI Really Outperform Human Trader]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1382</link>
			<pubDate>Sun, 06 Jul 2025 21:33:37 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=8179">PamelaChuby</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1382</guid>
			<description><![CDATA[If AI-driven charting tools are now analyzing patterns faster than any human, does that mean traditional technical analysis is obsolete? Or are we just overestimating algorithms and ignoring the gut instincts that make trading an art, not just a science?]]></description>
			<content:encoded><![CDATA[If AI-driven charting tools are now analyzing patterns faster than any human, does that mean traditional technical analysis is obsolete? Or are we just overestimating algorithms and ignoring the gut instincts that make trading an art, not just a science?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[CoinGecko Datasource]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1329</link>
			<pubDate>Sun, 22 Jun 2025 09:45:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1329</guid>
			<description><![CDATA[Good news: CoinGecko datasource will soon be supported by qchartist<br />
<br />
This idea to add this new data source came from the fact that i was not able to get the crypto chart of vault ai vaulta ausdt with the current available data sources of qchartist.<br />
I was a bit fustrated that tradingview had this coin and even other new coins but not qchartist<br />
<br />
Here are the python scripts in the attached zip file that will be used to get historical data and coin id list from the coingecko api.<br />
You can already use them with your python interpreter and open the obtained csv in qchartist.<br />
<br />
As you can see, i had to exclude the use of pandas and numpy modules in the scripts to avoid compatibility issues with python 3.8 w32<br />
These modules crash when they are imported with the python distrib included with qchartist<br />
<br />
To do so, i asked chatgpt to rewritte my python script without using pandas and numpy modules, the way the script functions exactly the same way.<br />
<br />
to obtain a 1h chart: use python pcgeck.py with command line arguments --interval 5min --days 33 then use period converter of 12 in qchartist<br />
to obtain a 4h chart : use python pcgeck.py with command line arguments --interval 15min --days 90 then use period converter of 16 in qchartist<br />
to obtain a daily chart : use the obtained 4h chart and use period converter of 6 in qchartist<br />
<br />
python pcoingecklist.py gets the list of all available symbols<br />
<br />
All that will soon be implemented for easy use via the data source gui interface<br />
<br />
Enjoy!<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.qchartist.net/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=121" target="_blank" title="">pycoingecko.zip</a> (Size: 2 KB / Downloads: 1)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Good news: CoinGecko datasource will soon be supported by qchartist<br />
<br />
This idea to add this new data source came from the fact that i was not able to get the crypto chart of vault ai vaulta ausdt with the current available data sources of qchartist.<br />
I was a bit fustrated that tradingview had this coin and even other new coins but not qchartist<br />
<br />
Here are the python scripts in the attached zip file that will be used to get historical data and coin id list from the coingecko api.<br />
You can already use them with your python interpreter and open the obtained csv in qchartist.<br />
<br />
As you can see, i had to exclude the use of pandas and numpy modules in the scripts to avoid compatibility issues with python 3.8 w32<br />
These modules crash when they are imported with the python distrib included with qchartist<br />
<br />
To do so, i asked chatgpt to rewritte my python script without using pandas and numpy modules, the way the script functions exactly the same way.<br />
<br />
to obtain a 1h chart: use python pcgeck.py with command line arguments --interval 5min --days 33 then use period converter of 12 in qchartist<br />
to obtain a 4h chart : use python pcgeck.py with command line arguments --interval 15min --days 90 then use period converter of 16 in qchartist<br />
to obtain a daily chart : use the obtained 4h chart and use period converter of 6 in qchartist<br />
<br />
python pcoingecklist.py gets the list of all available symbols<br />
<br />
All that will soon be implemented for easy use via the data source gui interface<br />
<br />
Enjoy!<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.qchartist.net/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=121" target="_blank" title="">pycoingecko.zip</a> (Size: 2 KB / Downloads: 1)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to create a custom indicator]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1246</link>
			<pubDate>Sun, 01 Jun 2025 11:40:42 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1246</guid>
			<description><![CDATA[Here is a simple diagram to explain how works the file structure and flow:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>+------------------+        +---------------------+        +-------------------+<br />
|  indicatorname.qtp| -----&gt; | &nbsp;&nbsp;indicatorname.qtr  | -----&gt; |  indicatorname.cpp | <br />
|  (Settings GUI) &nbsp;&nbsp;|        | (Runtime &amp; Drawing)  |        | (Calc &amp; Buffers) &nbsp;&nbsp;|<br />
+------------------+        +---------------------+        +-------------------+<br />
                                    |                           &nbsp;&nbsp;|<br />
                                    |                           &nbsp;&nbsp;|<br />
                                    v                           &nbsp;&nbsp;v<br />
                         &nbsp;&nbsp;+------------------+        +---------------------+<br />
                         &nbsp;&nbsp;|  getbufferdata.cpp| &lt;---- |  indicatornamebuffer  |<br />
                         &nbsp;&nbsp;| (Buffer Access) &nbsp;&nbsp;|     &nbsp;&nbsp;| &nbsp;&nbsp;(Static arrays)   &nbsp;&nbsp;|<br />
                         &nbsp;&nbsp;+------------------+        +---------------------+<br />
<br />
Additionally:<br />
+------------------+<br />
| indicatorname.ini |<br />
| (Meta Settings) &nbsp;&nbsp;|<br />
+------------------+<br />
<br />
+------------------+<br />
| &nbsp;&nbsp;cppincludes.cpp |<br />
| (Include cpp file)|<br />
+------------------+</code></div></div>]]></description>
			<content:encoded><![CDATA[Here is a simple diagram to explain how works the file structure and flow:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>+------------------+        +---------------------+        +-------------------+<br />
|  indicatorname.qtp| -----&gt; | &nbsp;&nbsp;indicatorname.qtr  | -----&gt; |  indicatorname.cpp | <br />
|  (Settings GUI) &nbsp;&nbsp;|        | (Runtime &amp; Drawing)  |        | (Calc &amp; Buffers) &nbsp;&nbsp;|<br />
+------------------+        +---------------------+        +-------------------+<br />
                                    |                           &nbsp;&nbsp;|<br />
                                    |                           &nbsp;&nbsp;|<br />
                                    v                           &nbsp;&nbsp;v<br />
                         &nbsp;&nbsp;+------------------+        +---------------------+<br />
                         &nbsp;&nbsp;|  getbufferdata.cpp| &lt;---- |  indicatornamebuffer  |<br />
                         &nbsp;&nbsp;| (Buffer Access) &nbsp;&nbsp;|     &nbsp;&nbsp;| &nbsp;&nbsp;(Static arrays)   &nbsp;&nbsp;|<br />
                         &nbsp;&nbsp;+------------------+        +---------------------+<br />
<br />
Additionally:<br />
+------------------+<br />
| indicatorname.ini |<br />
| (Meta Settings) &nbsp;&nbsp;|<br />
+------------------+<br />
<br />
+------------------+<br />
| &nbsp;&nbsp;cppincludes.cpp |<br />
| (Include cpp file)|<br />
+------------------+</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Some useful TradingView Pinescript indicators from me]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1239</link>
			<pubDate>Fri, 30 May 2025 10:37:29 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1239</guid>
			<description><![CDATA[These indicators have been converted by me and are not available in the public indicators database of tradingview<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="RD.COmbo", shorttitle="RD-Combo", overlay=false,<br />
 max_bars_back=2000, // Sufficient history for calculations, especially ForecastOsc<br />
 precision=2         // Adjust precision for plots if needed<br />
 )<br />
<br />
// --- Input Parameters ---<br />
bool DoAlertForEntry = input.bool(false, "Do Alert For Entry")<br />
bool DoAlertForExit = input.bool(false, "Do Alert For Exit")<br />
// HistorySize in MQL4 primarily limits the `start` loop iteration.<br />
// In Pine Script, plots automatically handle historical data.<br />
// We keep it as an input but it doesn't directly restrict plots.<br />
int HistorySize_input = input.int(1000, "History Size", minval=100)<br />
int ColorThreshold = input.int(5, "Color Threshold", minval=0, maxval=5)<br />
float NoiseFilterRVI = input.float(0.03, "RVI Exit Threshold", minval=0.0, step=0.01) // MQL4 uses 0.2 in condition, but input is 0.03. Using input.<br />
bool DebugLogger = input.bool(false, "Debug Logger (Console)")<br />
bool DebugLoggerData = input.bool(false, "Debug Logger Data (Console)")<br />
<br />
// --- Global variables for Signal State &amp; Alerts ---<br />
// `var` keyword ensures these variables retain their values across bars.<br />
var int signalstate = 0 // 1 = Long, -1 = Short, 0 = Neutral<br />
var bool didentryalert_pine = false<br />
var bool didexitalert_pine = false<br />
<br />
// --- ForecastOscillator Calculation Helper Functions ---<br />
<br />
// Helper function to calculate the weighted sum for `wt`<br />
f_calc_wt(src, len) =&gt;<br />
    float sum_val = 0.0<br />
    // Iterate from the current bar's position `len - i` to access past `src` values.<br />
    // MQL4 `Close[shift+length-i]` corresponds to `src[len - i]` for current bar `shift=0`.<br />
    for i = 1 to len<br />
        float tmp_coeff = i - (float(len) + 1.0) / 3.0<br />
        sum_val += tmp_coeff * src[len - i]<br />
    sum_val * 6.0 / (float(len) * (float(len) + 1.0))<br />
<br />
// ForecastOscillator logic<br />
f_forecast_osc_series(src_series, regress, t3, b) =&gt;<br />
    float b2 = b * b<br />
    float b3 = b2 * b<br />
    float c1 = -b3<br />
    float c2 = (3 * (b2 + b3))<br />
    float c3 = -3 * (2 * b2 + b + b3)<br />
    float c4 = (1 + 3 * b + b3 + 3 * b2)<br />
    float n = 1 + 0.5 * (float(t3) - 1)<br />
    float w1 = 2 / (n + 1)<br />
    float w2 = 1 - w1<br />
<br />
    // Calculate wt for the current bar<br />
    float wt = f_calc_wt(src_series, regress)<br />
<br />
    // Ensure `wt` is not too close to zero to avoid division by zero<br />
    float forecastosc = (src_series - wt) / (math.abs(wt) &lt; 1e-10 ? 1e-10 : wt) * 100<br />
<br />
    // T3 smoothing chain - these variables must persist across bars<br />
    var float e1 = na<br />
    var float e2 = na<br />
    var float e3 = na<br />
    var float e4 = na<br />
    var float e5 = na<br />
    var float e6 = na<br />
    <br />
    // Using nz() to handle initial `na` values<br />
    e1 := w1 * forecastosc + w2 * nz(e1[1])<br />
    e2 := w1 * e1 + w2 * nz(e2[1])<br />
    e3 := w1 * e2 + w2 * nz(e3[1])<br />
    e4 := w1 * e3 + w2 * nz(e4[1])<br />
    e5 := w1 * e4 + w2 * nz(e5[1])<br />
    e6 := w1 * e5 + w2 * nz(e6[1])<br />
    <br />
    float t3_fosc = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3<br />
    <br />
    [forecastosc, t3_fosc] // Return both series<br />
<br />
// --- Pre-calculate Forecast Oscillator values ---<br />
// Call the function on the 'close' series with MQL4's default parameters (15, 3, 0.7)<br />
[Osc, Osct3] = f_forecast_osc_series(close, 15, 3, 0.7)<br />
<br />
<br />
// --- Combo Indicator Logic (Translated from MQL4's Combo function) ---<br />
<br />
// Calculate all necessary indicator values for the current bar.<br />
// MQL4's `lookupidx` corresponds to `[0]` for the current bar in Pine.<br />
float ma5 = ta.wma(close, 5)<br />
float ma20 = ta.wma(close, 20)<br />
float ma100 = ta.wma(close, 100)<br />
float ma200 = ta.wma(close, 200)<br />
<br />
float cci = ta.cci(close, 5)<br />
<br />
// --- MANUAL RVI CALCULATION (REPLACEMENT FOR ta.rvi) ---<br />
// RVI Main (period 1 from MQL4) = (Close - Open) / (High - Low)<br />
float rvi_numerator_raw = close - open<br />
float rvi_denominator_raw = high - low<br />
float rvimain = rvi_denominator_raw != 0 ? rvi_numerator_raw / rvi_denominator_raw : 0.0<br />
<br />
// RVI Signal (period 1 from MQL4 implies a 4-period SMA of the main RVI)<br />
float rvisignal = ta.sma(rvimain, 4)<br />
// --- END MANUAL RVI CALCULATION ---<br />
<br />
<br />
// --- MANUAL ADX/DI CALCULATION (REPLACEMENT FOR ta.adx, ta.plus_di, ta.minus_di) ---<br />
f_calculate_adx_di(len) =&gt;<br />
    // True Range<br />
    tr1 = high - low<br />
    tr2 = math.abs(high - close[1])<br />
    tr3 = math.abs(low - close[1])<br />
    tr = math.max(tr1, tr2, tr3)<br />
<br />
    // Directional Movement<br />
    up = high - high[1]<br />
    down = low[1] - low<br />
<br />
    plusDM = up &gt; down and up &gt; 0 ? up : 0<br />
    minusDM = down &gt; up and down &gt; 0 ? down : 0<br />
<br />
    // Smoothed True Range and Directional Movements using RMA (Wilders Smoothing)<br />
    // ta.rma is the Pine Script equivalent of Wilders Smoothing<br />
    smoothTR = ta.rma(tr, len)<br />
    smoothPlusDM = ta.rma(plusDM, len)<br />
    smoothMinusDM = ta.rma(minusDM, len)<br />
<br />
    // Calculate DI+ and DI-<br />
    plusDI = smoothTR != 0 ? smoothPlusDM / smoothTR * 100 : 0<br />
    minusDI = smoothTR != 0 ? smoothMinusDM / smoothTR * 100 : 0<br />
<br />
    // Calculate DX<br />
    sumDI = plusDI + minusDI<br />
    dx = sumDI != 0 ? math.abs(plusDI - minusDI) / sumDI * 100 : 0<br />
<br />
    // Calculate ADX (smoothed DX)<br />
    adx = ta.rma(dx, len)<br />
    <br />
    [adx, plusDI, minusDI]<br />
<br />
// Apply the manual ADX/DI calculation for period 14<br />
[adxmain, adxplus, adxminus] = f_calculate_adx_di(14)<br />
<br />
// For previous bar values, we can simply use the `[1]` operator on the calculated series<br />
float adxmain2 = adxmain[1]<br />
float adxplus2 = adxplus[1]<br />
float adxminus2 = adxminus[1]<br />
// --- END MANUAL ADX/DI CALCULATION ---<br />
<br />
// Forecast Oscillator values for current bar (already calculated as series `Osc` and `Osct3`)<br />
float fcblue = Osc<br />
float fcred = Osct3<br />
<br />
// Initialize signal components<br />
int maval = 0<br />
int ccival = 0<br />
int rvival = 0<br />
int adxval = 0<br />
int fcval = 0<br />
<br />
// MA signal<br />
if ma5 &gt; ma20<br />
    maval := 1<br />
else if ma5 &lt; ma20<br />
    maval := -1<br />
<br />
// CCI signal<br />
if cci &gt; 0<br />
    ccival := 1<br />
else if cci &lt; 0<br />
    ccival := -1<br />
// Else ccival remains 0<br />
<br />
// Forecast Oscillator signal<br />
if fcblue &gt; 0 and fcred &gt; 0 and fcblue &gt; fcred<br />
    fcval := 1<br />
else if fcblue &lt; 0 and fcred &lt; 0 and fcblue &lt; fcred<br />
    fcval := -1<br />
// Else fcval remains 0<br />
<br />
// RVI signal<br />
if rvimain &gt; 0 and rvisignal &gt; 0 and rvimain - rvisignal &gt; 0<br />
    rvival := 1<br />
else if rvimain &lt; 0 and rvisignal &lt; 0 and rvimain - rvisignal &lt; 0<br />
    rvival := -1<br />
// Else rvival remains 0<br />
<br />
// ADX signal<br />
if adxmain &gt; adxmain2 and adxplus &gt; adxplus2 and adxmain &gt; 20 and adxplus &gt; 20<br />
    adxval := 1<br />
else if adxmain &gt; adxmain2 and adxminus &gt; adxminus2 and adxmain &gt; 20 and adxminus &gt; 20<br />
    adxval := -1<br />
// Else adxval remains 0<br />
<br />
// Calculate the total combined signal strength<br />
float val = maval + ccival + fcval + rvival + adxval<br />
<br />
// --- Exit Signal Logic ---<br />
// Note: MQL4 used a constant `0.2` for RVI exit threshold, but `NoiseFilterRVI` input was 0.03.<br />
// We are using the `NoiseFilterRVI` input for consistency.<br />
if signalstate != 0<br />
    if signalstate == 1 and (rvimain &lt; 0 or (rvisignal - rvimain) &gt; NoiseFilterRVI)<br />
        signalstate := 0 // Exit long<br />
    if signalstate == -1 and (rvimain &gt; 0 or (rvimain - rvisignal) &gt; NoiseFilterRVI)<br />
        signalstate := 0 // Exit short<br />
<br />
// --- Debugging Output (to Pine Script console) ---<br />
if DebugLogger or DebugLoggerData<br />
    // Check for sufficient historical bars before logging to avoid errors with `[1]` etc.<br />
    if bar_index &gt;= math.max(14, 200) // At least 200 bars for MAs, 14 for ADX. Min 31+regress=46 for FO.<br />
        if DebugLoggerData<br />
            log.info("--------------------------------------------------------------------------")<br />
            log.info("Time: {0}, Bar: {1}, MA 5/20/100/200: {2}/{3}/{4}/{5}",<br />
                 timenow, bar_index, ma5, ma20, ma100, ma200)<br />
            log.info("Time: {0}, Bar: {1}, CCI: {2}, RVI: {3}/{4}",<br />
                 timenow, bar_index, cci, rvimain, rvisignal)<br />
            log.info("Time: {0}, Bar: {1}, ADX(now): {2}/{3}/{4}",<br />
                 timenow, bar_index, adxmain, adxplus, adxminus)<br />
            log.info("Time: {0}, Bar: {1}, ADX(prev): {2}/{3}/{4}",<br />
                 timenow, bar_index, adxmain2, adxplus2, adxminus2)<br />
            log.info("Time: {0}, Bar: {1}, Forecast blue/red: {2}/{3}",<br />
                 timenow, bar_index, fcblue, fcred)<br />
<br />
        log.info("Time: {0}, Bar: {1}, MAtrend({2}) + CCI({3}) + FC({4}) + RVItrend({5}) + ADXtrend({6}) =&gt; {7} # trade state = {8}",<br />
             timenow, bar_index, maval, ccival, fcval, rvival, adxval, val, signalstate)<br />
<br />
<br />
// --- Determine Plot Values ---<br />
// These are the buffers from MQL4 (Neutral, Short, Long, Signal)<br />
float NeutralBuffer_val = 0.0<br />
float LongSignalBuffer_val = 0.0<br />
float ShortSignalBuffer_val = 0.0<br />
<br />
if val &gt;= ColorThreshold<br />
    LongSignalBuffer_val := val<br />
    signalstate := 1 // Set signalstate to long if conditions met<br />
else if val &lt;= -ColorThreshold<br />
    ShortSignalBuffer_val := val<br />
    signalstate := -1 // Set signalstate to short if conditions met<br />
else<br />
    NeutralBuffer_val := val // Neutral, between thresholds<br />
    // If we're neutral, but previously in a signal, it might be an exit condition.<br />
    // The `signalstate` is managed by the exit logic above.<br />
    // So if the current `val` is neutral, but `signalstate` was set by an exit condition, it remains 0.<br />
    // If `val` is neutral and there was no exit, `signalstate` also becomes 0.<br />
    if math.abs(val) &lt; ColorThreshold and signalstate != 0<br />
        signalstate := 0 // If signal goes neutral and no specific RVI exit occurred, also reset.<br />
<br />
<br />
// SignalBuffer: MQL4 uses `2 * signalstate`<br />
float SignalBuffer_val = 2 * signalstate<br />
<br />
// --- Plotting ---<br />
// Removed minval and maxval as they are not recognized in your environment.<br />
// The indicator will now auto-scale based on the values plotted.<br />
plot(NeutralBuffer_val, title="Neutral", color=color.rgb(128, 128, 128), style=plot.style_columns, linewidth=2, histbase=0) // Gray<br />
plot(ShortSignalBuffer_val, title="Short Signal", color=color.rgb(255, 69, 0), style=plot.style_columns, linewidth=2, histbase=0) // OrangeRed<br />
plot(LongSignalBuffer_val, title="Long Signal", color=color.rgb(124, 252, 0), style=plot.style_columns, linewidth=2, histbase=0) // LawnGreen<br />
<br />
plot(SignalBuffer_val, title="Signal Line", color=color.rgb(255, 215, 0), style=plot.style_line, linewidth=1) // Gold<br />
<br />
// Plotting MQL4 levels (4 and -4) - these will still help visually define a range.<br />
hline(4, "Level +4", color.rgb(100, 100, 100), linestyle=hline.style_dashed)<br />
hline(-4, "Level -4", color.rgb(100, 100, 100), linestyle=hline.style_dashed)<br />
<br />
<br />
// --- Alerting Logic ---<br />
// MQL4: `SignalBuffer[0]!=0 &amp;&amp; SignalBuffer[1]==0` for entry<br />
// Pine: `SignalBuffer_val != 0 and SignalBuffer_val[1] == 0` for entry<br />
if DoAlertForEntry and SignalBuffer_val != 0 and nz(SignalBuffer_val[1]) == 0<br />
    if not didentryalert_pine<br />
        alert("RD signals trade entry on " + syminfo.ticker + "/" + timeframe.period, alert.freq_once_per_bar)<br />
        didentryalert_pine := true<br />
else<br />
    didentryalert_pine := false // Reset alert flag when no entry signal<br />
<br />
// MQL4: `SignalBuffer[0]==0 &amp;&amp; SignalBuffer[1]!=0` for exit<br />
// Pine: `SignalBuffer_val == 0 and SignalBuffer_val[1] != 0` for exit<br />
if DoAlertForExit and SignalBuffer_val == 0 and nz(SignalBuffer_val[1]) != 0<br />
    if not didexitalert_pine<br />
        alert("RD signals trade exit on " + syminfo.ticker + "/" + timeframe.period, alert.freq_once_per_bar)<br />
        didexitalert_pine := true<br />
else<br />
    didexitalert_pine := false // Reset alert flag when no exit signal</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="Weekly Pivot", shorttitle="WeeklyPivot", overlay=true)<br />
<br />
//--- Global variables for pivot values (will retain their value across bars)<br />
var float P_val  = na<br />
var float S1_val = na<br />
var float R1_val = na<br />
var float S2_val = na<br />
var float R2_val = na<br />
var float S3_val = na<br />
var float R3_val = na<br />
<br />
//--- Global variables for labels (will hold label IDs)<br />
var label P_label  = na<br />
var label S1_label = na<br />
var label R1_label = na<br />
var label S2_label = na<br />
var label R2_label = na<br />
var label S3_label = na<br />
var label R3_label = na<br />
<br />
// --- Input for font size (from MQL4's fontsize)<br />
var int fontsize_input = input.int(10, "Label Font Size", minval=6, maxval=24)<br />
<br />
// --- Detect start of a new week (typically Monday, first bar of the week)<br />
// `ta.change(time("W"))` returns true on the first bar of a new weekly period.<br />
new_week = ta.change(time("W"))<br />
<br />
// --- Get previous week's data<br />
// request.security is used to fetch historical High, Low, and Close from the *completed* previous week.<br />
// `[1]` refers to the previous weekly bar.<br />
// `lookahead=barmerge.lookahead_on` ensures we get the value from the *closed* previous week.<br />
[prev_w_high, prev_w_low, prev_w_close] = request.security(syminfo.tickerid, "W", [high[1], low[1], close[1]], lookahead=barmerge.lookahead_on)<br />
<br />
// --- Main Calculation: Calculate pivots only on the first bar of a new week ---<br />
if new_week<br />
    // The current bar's open is the open of the new week.<br />
    current_week_open = open<br />
<br />
    // Calculate Pivot Points based on the MQL4 formula:<br />
    // P = (Previous Week High + Previous Week Low + Current Week Open + Previous Week Close) / 4<br />
    P_val  := (prev_w_high + prev_w_low + current_week_open + prev_w_close) / 4<br />
    R1_val := (2 * P_val) - prev_w_low<br />
    S1_val := (2 * P_val) - prev_w_high<br />
    R2_val := P_val + (prev_w_high - prev_w_low)<br />
    S2_val := P_val - (prev_w_high - prev_w_low)<br />
    R3_val := (2 * P_val) + (prev_w_high - (2 * prev_w_low))<br />
    S3_val := (2 * P_val) - ((2 * prev_w_high) - prev_w_low)<br />
<br />
    // --- Create/Update Labels for Pivot Levels ---<br />
    // If labels don't exist yet (first run of script, or after reset), create them.<br />
    // Otherwise, update their position and value.<br />
    if na(P_label) // Check if the main pivot label is 'na' to know if all labels need creating<br />
        // Create labels with transparent background (`color.new(color.white, 100)`)<br />
        P_label  := label.new(x=time, y=P_val, text="Weekly Pivot Point", xloc=xloc.bar_time, yloc=yloc.price,<br />
                             color=color.new(color.white, 100), textcolor=color.rgb(255, 0, 255), size=size.small, style=label.style_label_left) // Magenta<br />
        S1_label := label.new(x=time, y=S1_val, text="wS 1", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(65, 105, 225), size=size.small, style=label.style_label_left) // RoyalBlue<br />
        R1_label := label.new(x=time, y=R1_val, text="wR 1", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(220, 20, 60), size=size.small, style=label.style_label_left) // Crimson<br />
        S2_label := label.new(x=time, y=S2_val, text="wS 2", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(65, 105, 225), size=size.small, style=label.style_label_left) // RoyalBlue<br />
        R2_label := label.new(x=time, y=R2_val, text="wR 2", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(220, 20, 60), size=size.small, style=label.style_label_left) // Crimson<br />
        S3_label := label.new(x=time, y=S3_val, text="wS 3", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(46, 139, 87), size=size.small, style=label.style_label_left) // SeaGreen<br />
        R3_label := label.new(x=time, y=R3_val, text="wR 3", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(46, 139, 87), size=size.small, style=label.style_label_left) // SeaGreen<br />
    <br />
    // Update labels (for existing ones, and for newly created ones on the same bar)<br />
    label.set_xy(P_label, x=time, y=P_val)<br />
    label.set_xy(S1_label, x=time, y=S1_val)<br />
    label.set_xy(R1_label, x=time, y=R1_val)<br />
    label.set_xy(S2_label, x=time, y=S2_val)<br />
    label.set_xy(R2_label, x=time, y=R2_val)<br />
    label.set_xy(S3_label, x=time, y=S3_val)<br />
    label.set_xy(R3_label, x=time, y=R3_val)<br />
<br />
    // Update label text if you want to include values (MQL4 only used fixed text)<br />
    // For example: `label.set_text(P_label, "Weekly Pivot Point: " + str.tostring(P_val))`<br />
    // But sticking to MQL4 original, fixed text is used.<br />
<br />
    // Update font size (MQL4 only sets this on init, but we can make it dynamic here if desired)<br />
    // For a constant font size, it's better to pass it directly to label.new and avoid updating every week.<br />
    // However, if we added an input for fontsize, we would set it here.<br />
    // Example: label.set_size(P_label, f_get_label_size(fontsize_input))<br />
    // For now, size.small is hardcoded based on MQL4's fontsize=10.<br />
<br />
// --- Plotting the Pivot Lines ---<br />
// The `P_val`, `S1_val`, etc. variables retain their last calculated value thanks to `var`.<br />
// This makes them horizontal lines spanning the entire week until a new calculation occurs.<br />
<br />
plot(P_val,  title="Weekly Pivot Point", color=color.rgb(255, 0, 255), linewidth=2, style=plot.style_line) // Magenta<br />
plot(S1_val, title="W_S 1",              color=color.rgb(65, 105, 225), linewidth=2, style=plot.style_line) // RoyalBlue<br />
plot(R1_val, title="W_R 1",              color=color.rgb(220, 20, 60),  linewidth=2, style=plot.style_line) // Crimson<br />
plot(S2_val, title="W_S 2",              color=color.rgb(65, 105, 225), linewidth=2, style=plot.style_line) // RoyalBlue<br />
plot(R2_val, title="W_R 2",              color=color.rgb(220, 20, 60),  linewidth=2, style=plot.style_line) // Crimson<br />
plot(S3_val, title="W_S 3",              color=color.rgb(46, 139, 87),  linewidth=2, style=plot.style_line) // SeaGreen<br />
plot(R3_val, title="W_R 3",              color=color.rgb(46, 139, 87),  linewidth=2, style=plot.style_line) // SeaGreen</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="Weighted WCCI", shorttitle="Weighted WCCI", overlay=false)<br />
<br />
//--- Input Parameters ---<br />
TCCIp       = input.int(7, "Turbo CCI Period", minval=1)<br />
CCIp        = input.int(13, "CCI Period", minval=1)<br />
overbslevel = input.float(200.0, "Overbought/Oversold Level")<br />
triglevel   = input.float(50.0, "Trigger Level")<br />
weight      = input.float(1.0, "Weight")<br />
<br />
//--- Pine Script Buffers (variables for plotting) ---<br />
var float ExtMapBuffer1 = na // Turbo CCI (Red)<br />
var float ExtMapBuffer2 = na // CCI (DodgerBlue)<br />
var float ExtMapBuffer3 = na // CCI Histogram (CadetBlue)<br />
var float ExtMapBuffer4 = na // Overbought Level (Red)<br />
var float ExtMapBuffer5 = na // Oversold Level (Red)<br />
var float ExtMapBuffer6 = na // Trigger Level (RoyalBlue)<br />
var float ExtMapBuffer7 = na // Negative Trigger Level (RoyalBlue)<br />
var float ExtMapBuffer8 = na // Zero Level (PaleGreen)<br />
<br />
//--- Global variables for trend tracking (mimicking MQL4's trend_counter and trend string) ---<br />
var int trend_counter = 0<br />
var string trend = "ZERO"<br />
<br />
//--- Main Calculation ---<br />
// MQL4's iCCI(NULL,0,Period,PRICE_TYPICAL,shift) translates to ta.cci(hlc3, Period)[shift]<br />
// MQL4's iATR(NULL,0,Period,shift) translates to ta.atr(Period)[shift]<br />
<br />
// Calculate CCI and Turbo CCI for the current bar (shift = 0 in MQL4)<br />
float currentCCI  = ta.cci(hlc3, CCIp)<br />
float currentTCCI = ta.cci(hlc3, TCCIp)<br />
<br />
// Calculate ATR for the current bar (shift = 0 in MQL4)<br />
float atr7  = ta.atr(7)<br />
float atr49 = ta.atr(49)<br />
<br />
float Kw = 0.0<br />
<br />
if weight == 0<br />
    Kw := 0.0<br />
else<br />
    Kw := weight * (atr7 / atr49)<br />
    currentCCI  := currentCCI * Kw<br />
    currentTCCI := currentTCCI * Kw<br />
<br />
// Clamp values as per MQL4 logic<br />
if currentTCCI &gt; overbslevel + 50<br />
    currentTCCI := overbslevel + 50<br />
if currentCCI &gt; overbslevel + 50<br />
    currentCCI := overbslevel + 50<br />
if currentCCI &lt; -overbslevel - 50<br />
    currentCCI := -overbslevel - 50<br />
if currentTCCI &lt; -overbslevel - 50<br />
    currentTCCI := -overbslevel - 50<br />
<br />
// Assign values to plotting variables<br />
ExtMapBuffer1 := currentTCCI<br />
ExtMapBuffer2 := currentCCI<br />
ExtMapBuffer3 := currentCCI // Used for histogram<br />
ExtMapBuffer4 := overbslevel<br />
ExtMapBuffer5 := -overbslevel<br />
ExtMapBuffer6 := triglevel<br />
ExtMapBuffer7 := -triglevel<br />
ExtMapBuffer8 := 0.0<br />
<br />
// --- Trend Logic (for comment only) ---<br />
// Pine Script executes on every bar, so we handle previous bar state with `[1]` or `var` variables.<br />
// The MQL4 `shift==0` logic applies to the current bar.<br />
if barstate.islast<br />
    // Let's replicate the MQL4 logic as closely as possible for the `trend` string and `trend_counter`.<br />
    // It is important to note that MQL4's `trend` variable is a global.<br />
    // In Pine, `var` ensures persistence across bars.<br />
<br />
    if currentCCI &gt; 0<br />
        if trend[1] == "UP" // Using [1] to get the value from the *previous* bar<br />
            trend_counter := trend_counter[1] + 1<br />
        else<br />
            trend_counter := 1<br />
            trend := "UP"<br />
    else if currentCCI &lt; 0 // Assuming MQL4 implied `currentCCI &lt; 0` for "DOWN"<br />
        if trend[1] == "DOWN"<br />
            trend_counter := trend_counter[1] + 1<br />
        else<br />
            trend_counter := 1<br />
            trend := "DOWN"<br />
    else // currentCCI == 0 or very close<br />
        trend_counter := 1<br />
        trend := "ZERO"<br />
<br />
    // The MQL4 'Comment' function for status bar text is removed for Pine compatibility<br />
    // You can see the `trend` and `trend_counter` values in the Data Window when hovering over the indicator.<br />
<br />
<br />
//--- Plotting ---<br />
// Plot 0: Turbo CCI<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer1, title="Turbo CCI", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1)<br />
<br />
// Plot 1: CCI<br />
// Changed color.dodgerBlue to color.rgb(30, 144, 255)<br />
plot(ExtMapBuffer2, title="CCI", color=color.rgb(30, 144, 255), style=plot.style_line, linewidth=3)<br />
<br />
// Plot 2: CCI Histogram<br />
// Changed color.cadetBlue to color.rgb(95, 158, 160)<br />
plot(ExtMapBuffer3, title="CCI Histogram", color=color.rgb(95, 158, 160), style=plot.style_columns)<br />
<br />
// Plot 3: Overbought Level (Red)<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer4, title="Overbought Level", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 4: Oversold Level (Red)<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer5, title="Oversold Level", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 5: Trigger Level (RoyalBlue)<br />
// Changed color.royalBlue to color.rgb(65, 105, 225)<br />
plot(ExtMapBuffer6, title="Trigger Level (+)", color=color.rgb(65, 105, 225), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 6: Negative Trigger Level (RoyalBlue)<br />
// Changed color.royalBlue to color.rgb(65, 105, 225)<br />
plot(ExtMapBuffer7, title="Trigger Level (-)", color=color.rgb(65, 105, 225), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 7: Zero Level (PaleGreen)<br />
// Changed color.paleGreen to color.rgb(152, 251, 152)<br />
plot(ExtMapBuffer8, title="Zero Level", color=color.rgb(152, 251, 152), style=plot.style_line, linewidth=1, show_last=5000)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("SwamiRSI_v1", shorttitle="SwamiRSI_v1", overlay=false)<br />
<br />
//--- Input Parameters ---<br />
var int g_visualMode  = input.int(0, "Visual Mode (0=original, 1=trend)", minval=0, maxval=1)<br />
var int g_priceType   = input.int(0, "Applied Price (0=Close, 1=Open, 2=High, 3=Low, 4=Median, 5=Typical; 6=Weighted)", minval=0, maxval=6)<br />
var int g_startLength = input.int(12, "RSI Start Period", minval=1)<br />
var int g_endLength   = input.int(48, "RSI End Period", minval=1)<br />
var int g_sampleLength = input.int(48, "Sample RSI Period (0=off)", minval=0)<br />
var int g_smooth      = input.int(5, "Smoothing Period", minval=1)<br />
var color g_upTrendColor  = input.color(color.lime, "UpTrend Color")<br />
var color g_dnTrendColor  = input.color(color.red, "DownTrend Color")<br />
var color g_flatColor     = input.color(color.yellow, "Flat Color (if CLR_NONE, 2 Color Mix)")<br />
var int g_scaleMode   = input.int(1, "Scale Mode (0=J.Ehlers, 1=0...100)", minval=0, maxval=1)<br />
var int g_swamiBars   = input.int(100, "Swami Bars (-1=off, 0=all Bars, &gt;0=any number)")<br />
<br />
// --- Helper Functions ---<br />
<br />
// Get applied price based on input<br />
f_get_price(priceType) =&gt;<br />
    switch priceType<br />
        0 =&gt; close<br />
        1 =&gt; open<br />
        2 =&gt; high<br />
        3 =&gt; low<br />
        4 =&gt; (high + low) / 2<br />
        5 =&gt; (high + low + close) / 3<br />
        6 =&gt; (open + high + low + close) / 4<br />
        =&gt; close // Default to close if invalid type<br />
<br />
// Custom EMA function to mimic MQL4 behavior more closely<br />
// It stores previous EMA value in a separate buffer for state management across bars<br />
// `ema_array`: an array that stores the previous EMA value for each 'index' (used by MQL4's ema[][2])<br />
// `price_val`: the current price value for the EMA calculation<br />
// `period`: the EMA period<br />
// `idx`: the index within the ema_array to store the value (corresponds to MQL4's `index` argument)<br />
f_ema(ema_array, price_val, period, idx) =&gt;<br />
    prev_ema_val = array.get(ema_array, idx)<br />
    current_ema_val = if bar_index == 0 or na(prev_ema_val)<br />
        price_val<br />
    else<br />
        prev_ema_val + 1.0 / period * (price_val - prev_ema_val)<br />
    array.set(ema_array, idx, current_ema_val)<br />
    current_ema_val<br />
<br />
// Custom _RSI calculation (mimics MQL4 logic)<br />
// `index`: corresponds to the 'i' in the MQL4 loop, used for array indexing<br />
// `change`: current price change (price[0] - price[1])<br />
// `period`: RSI period (StartLength + index)<br />
// `ema_array`: array to pass to the f_ema function<br />
// `swamisize`: from MQL4's swamisize global<br />
f_custom_rsi(index, change, period, ema_array, swamisize) =&gt;<br />
    totChg = math.abs(change)<br />
<br />
    // MQL4's EMA function uses `ema[index][0]` and `ema[index][1]`, and `prevtime[index]`<br />
    // Here, we use indices for `ema_array`:<br />
    // NetChgAvg uses `index` (0 to swamisize-1)<br />
    // TotChgAvg uses `index + swamisize`<br />
    // Final RSI EMA uses `index + 2*swamisize`<br />
    netChgAvg = f_ema(ema_array, change, period, index)<br />
    totChgAvg = f_ema(ema_array, totChg, period, index + swamisize)<br />
<br />
    chgRatio = if totChgAvg != 0<br />
        netChgAvg / totChgAvg<br />
    else<br />
        0.0<br />
<br />
    rsiVal = f_ema(ema_array, 2 * chgRatio + 0.5, g_smooth, index + 2 * swamisize)<br />
<br />
    math.max(0, math.min(1, rsiVal)) // Clamp between 0 and 1<br />
<br />
// --- Global Variables (converted from MQL4's global arrays) ---<br />
var float[] g_ema = na // Will be initialized on first bar<br />
var int[] g_trend = na   // Will be initialized on first bar<br />
<br />
var float g_fuzzWidth = na<br />
var float g_maxValue = na<br />
var float g_minValue = na<br />
<br />
var int g_swamisize = na<br />
var float g_priceCurrent = na<br />
var float g_pricePrevious = na<br />
<br />
// --- For Box Management ---<br />
// We need a global array to store all created boxes so we can delete them.<br />
var box[] all_swami_boxes = array.new_box(0)<br />
<br />
// --- Main Calculation ---<br />
g_priceCurrent := f_get_price(g_priceType)<br />
g_pricePrevious := f_get_price(g_priceType)[1] // Price of the previous bar<br />
<br />
// Initialize/resize arrays and set initial values on first bar<br />
if bar_index == 0<br />
    g_swamisize := g_endLength - g_startLength + 1<br />
    // Corrected lines: Directly assign newly created arrays<br />
    g_ema := array.new_float(g_swamisize * 3, na) // Initialize with 'na' values<br />
    g_trend := array.new_int(g_swamisize, 0)     // Initialize with 0s<br />
<br />
    if g_sampleLength &gt; 0<br />
        g_sampleLength := math.max(g_startLength, g_sampleLength)<br />
        g_sampleLength := math.min(g_endLength, g_sampleLength)<br />
<br />
    if g_scaleMode == 0 // J. Ehlers mode<br />
        g_fuzzWidth := 1.0<br />
        g_maxValue := float(g_endLength)<br />
        g_minValue := float(g_startLength)<br />
    else // 0-100 mode<br />
        g_fuzzWidth := 100.0 / (g_endLength - g_startLength)<br />
        g_maxValue := 100.0<br />
        g_minValue := 0.0<br />
<br />
// Variables for plotting<br />
var float rsiPlot = na<br />
var float sumRSIPlot = na<br />
<br />
// Only calculate if enough bars are available<br />
if bar_index &gt;= g_endLength<br />
    currentChange = g_priceCurrent - g_pricePrevious<br />
<br />
    swamiSum = 0.0<br />
    swamiRSI_values = array.new_float(g_swamisize) // Temporary array for current bar's SwamiRSI values<br />
<br />
    for i = 0 to g_swamisize - 1<br />
        currentRsiPeriod = g_startLength + i<br />
        <br />
        // Calculate the custom RSI (clamped between 0 and 1)<br />
        rsi_value_clamped = f_custom_rsi(i, currentChange, currentRsiPeriod, g_ema, g_swamisize)<br />
<br />
        if g_visualMode == 0 // Original mode<br />
            array.set(swamiRSI_values, i, rsi_value_clamped)<br />
            swamiSum += rsi_value_clamped<br />
        else // Trend mode<br />
            // Get the trend state from the previous bar's calculation (stored in g_trend)<br />
            current_trend_state = array.get(g_trend, i)<br />
            <br />
            if rsi_value_clamped &gt; 0.5<br />
                current_trend_state := 1<br />
            else if rsi_value_clamped &lt; 0.5<br />
                current_trend_state := 0<br />
            <br />
            array.set(g_trend, i, current_trend_state) // Update global trend array for next bar<br />
            array.set(swamiRSI_values, i, float(current_trend_state))<br />
            swamiSum += float(current_trend_state)<br />
<br />
    if g_scaleMode == 0 // J. Ehlers mode<br />
        if g_sampleLength &gt; 0<br />
            // Find the index for sampleLength<br />
            sampleIndex = g_sampleLength - g_startLength<br />
            rsiPlot := float(g_startLength) + (float(g_swamisize) - 1.0) * array.get(swamiRSI_values, sampleIndex)<br />
        else<br />
            rsiPlot := na // If SampleLength is 0, MQL4 also seems to not plot RSI<br />
        sumRSIPlot := float(g_startLength) + (float(g_swamisize) - 1.0) * (swamiSum / float(g_swamisize))<br />
    else // 0-100 mode<br />
        if g_sampleLength &gt; 0<br />
            // Find the index for sampleLength<br />
            sampleIndex = g_sampleLength - g_startLength<br />
            rsiPlot := 100.0 * array.get(swamiRSI_values, sampleIndex)<br />
        else<br />
            rsiPlot := na // If SampleLength is 0, MQL4 also seems to not plot RSI<br />
        sumRSIPlot := 100.0 * (swamiSum / float(g_swamisize))<br />
<br />
    // --- Dynamic Rectangle Plotting (Swami Bars) ---<br />
    plot_boxes = false<br />
    if g_swamiBars == 0<br />
        plot_boxes = true // Plot on all bars<br />
    else if g_swamiBars &gt; 0 and bar_index &gt;= (last_bar_index - g_swamiBars)<br />
        plot_boxes = true // Plot for the last 'g_swamiBars' bars<br />
<br />
    // Clear all existing boxes at the start of the current bar's calculation<br />
    // or if the indicator is re-initializing (barstate.isfirst)<br />
    if barstate.islast or barstate.isfirst<br />
        // Added check for array size before looping to prevent out-of-bounds error<br />
        if array.size(all_swami_boxes) &gt; 0<br />
            // Iterate through our stored box IDs and delete them<br />
            for i = 0 to array.size(all_swami_boxes) - 1<br />
                box.delete(array.get(all_swami_boxes, i))<br />
        // Clear the array after deleting objects (can always clear an empty array safely)<br />
        array.clear(all_swami_boxes)<br />
<br />
    if plot_boxes<br />
        for i = 0 to g_swamisize - 1<br />
            currentSwamiRSI = array.get(swamiRSI_values, i)<br />
            barColor = color.new(color.white, 0) // Initialize with a dummy color and full transparency<br />
<br />
            isFlatColorNone = (g_flatColor == color.new(color.fuchsia, 0)) // Using fuchsia as proxy for CLR_NONE<br />
<br />
            if isFlatColorNone // This implies a 2-color mix (UpTrendColor and DnTrendColor)<br />
                r1 = color.r(g_dnTrendColor) + currentSwamiRSI * (color.r(g_upTrendColor) - color.r(g_dnTrendColor))<br />
                g1 = color.g(g_dnTrendColor) + currentSwamiRSI * (color.g(g_upTrendColor) - color.g(g_dnTrendColor))<br />
                b1 = color.b(g_dnTrendColor) + currentSwamiRSI * (color.b(g_upTrendColor) - color.b(g_dnTrendColor))<br />
                barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
            else // 3 Color Mix with FlatColor<br />
                if currentSwamiRSI &gt;= 0.5<br />
                    r1 = color.r(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.r(g_flatColor) - color.r(g_upTrendColor))<br />
                    g1 = color.g(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.g(g_flatColor) - color.g(g_upTrendColor))<br />
                    b1 = color.b(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.b(g_flatColor) - color.b(g_upTrendColor))<br />
                    barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
                else <br />
                    r1 = color.r(g_dnTrendColor) + 2 * currentSwamiRSI * (color.r(g_flatColor) - color.r(g_dnTrendColor))<br />
                    g1 = color.g(g_dnTrendColor) + 2 * currentSwamiRSI * (color.g(g_flatColor) - color.g(g_dnTrendColor))<br />
                    b1 = color.b(g_dnTrendColor) + 2 * currentSwamiRSI * (color.b(g_flatColor) - color.b(g_dnTrendColor))<br />
                    barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
<br />
            currentValue = if g_scaleMode == 0<br />
                float(i + g_startLength)<br />
            else<br />
                float(i) * g_fuzzWidth<br />
<br />
            // Create the box and store its ID in our global array<br />
            newBox = box.new(time[0], currentValue - 0.5 * g_fuzzWidth,<br />
                             time, currentValue + 0.5 * g_fuzzWidth,<br />
                             border_color=barColor, border_width=0, bgcolor=color.new(barColor, 50))<br />
            array.push(all_swami_boxes, newBox) // Add the new box ID to our array<br />
    else<br />
        // If not plotting boxes for this bar, ensure all boxes are deleted<br />
        if bar_index == last_bar_index and g_swamiBars == -1<br />
            // Added check for array size before looping<br />
            if array.size(all_swami_boxes) &gt; 0<br />
                for i = 0 to array.size(all_swami_boxes) - 1<br />
                    box.delete(array.get(all_swami_boxes, i))<br />
            array.clear(all_swami_boxes)<br />
<br />
<br />
// --- Plotting the Lines ---<br />
plot(rsiPlot, "SwamiRSI_Sample", color.rgb(139, 0, 139), style=plot.style_line, linewidth=2) // DarkOrchid<br />
plot(sumRSIPlot, "SummaryRSI", color.rgb(210, 105, 30), style=plot.style_line, linewidth=2) // Chocolate<br />
<br />
// Plot horizontal lines for min/max values<br />
plot(g_minValue, "Min Value", color.gray, style=plot.style_stepline)<br />
plot(g_maxValue, "Max Value", color.gray, style=plot.style_stepline)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Past Regression Deviated", overlay=true)<br />
<br />
// Input parameters<br />
var int lrLength = input.int(500, "LR Length (bars back)", minval=1)<br />
var float stdChannel1 = input.float(1.0, "Std Channel 1 Multiplier", minval=0.0)<br />
var float stdChannel2 = input.float(2.0, "Std Channel 2 Multiplier", minval=0.0)<br />
var float stdChannel3 = input.float(3.0, "Std Channel 3 Multiplier", minval=0.0)<br />
<br />
// Function to calculate Linear Regression coefficients (a and b)<br />
// Returns [a, b] for y = a + b*x, where x=0 is the *oldest* bar in the window<br />
// and x=length-1 is the *current* bar in the window.<br />
f_linreg_coeffs(source, length) =&gt;<br />
    if length &lt;= 1<br />
        [float(na), float(na), float(na)] // Return a, b, and a flag for denominator == 0<br />
    else<br />
        sumY = 0.0<br />
        sumX = 0.0<br />
        sumXY = 0.0<br />
        sumX2 = 0.0<br />
        for i = 0 to length - 1<br />
            val = source[i]<br />
            // 'x' here represents the position within the current `length` window,<br />
            // with 0 being the oldest bar in the window, and `length - 1` being the newest (current bar).<br />
            x = float(length - 1 - i)<br />
            sumY += val<br />
            sumXY += val * x<br />
            sumX += x<br />
            sumX2 += x * x<br />
        <br />
        denominator = length * sumX2 - sumX * sumX<br />
        <br />
        if denominator == 0<br />
            [float(na), float(na), float(na)]<br />
        else<br />
            b = (length * sumXY - sumX * sumY) / denominator<br />
            a = (sumY - b * sumX) / length<br />
            [a, b, 1.0] // Return coefficients and success flag<br />
<br />
// Function to calculate Standard Deviation<br />
// Takes source series, regression coefficients (a, b), and length<br />
calc_stddev(source, a_coeff, b_coeff, length) =&gt;<br />
    sumSquaredDev = 0.0<br />
    count = 0<br />
    <br />
    if na(a_coeff) or na(b_coeff)<br />
        0.0 // Cannot calculate if coefficients are NA<br />
<br />
    for i = 0 to length - 1<br />
        // 'x_val' is the position within the current `length` window for this bar `i`<br />
        // where 0 is the oldest bar and `length - 1` is the current bar.<br />
        x_val = float(length - 1 - i)<br />
        <br />
        // Calculate the LR value at this specific bar using the computed 'a' and 'b'<br />
        lr_val_at_i = a_coeff + b_coeff * x_val<br />
        <br />
        dev = math.abs(source[i] - lr_val_at_i)<br />
        sumSquaredDev += dev * dev<br />
        count += 1<br />
    <br />
    if count &lt;= 1<br />
        0.0<br />
    else<br />
        math.sqrt(sumSquaredDev / (count - 1))<br />
<br />
// Declare variables to store the calculated values<br />
var float meanBuffer = na<br />
var float lrPrice1 = na // This corresponds to the start of the LR line (oldest point in range)<br />
var float currentStdDev = na<br />
<br />
// Calculate on each historical bar and the last bar<br />
if barstate.islast or barstate.isconfirmed<br />
    // Get the regression coefficients for the current window<br />
    [a_lr, b_lr, success_flag] = f_linreg_coeffs(close, lrLength)<br />
<br />
    if not na(success_flag) // Only proceed if coefficients were calculated successfully<br />
        // meanBuffer corresponds to the LR value at the current bar (newest point in range)<br />
        meanBuffer := a_lr + b_lr * (lrLength - 1)<br />
        <br />
        // lrPrice1 corresponds to the LR value at the oldest bar in the range<br />
        lrPrice1 := a_lr<br />
        <br />
        // Calculate standard deviation using the obtained coefficients<br />
        currentStdDev := calc_stddev(close, a_lr, b_lr, lrLength)<br />
    else<br />
        meanBuffer := na<br />
        lrPrice1 := na<br />
        currentStdDev := na<br />
<br />
<br />
// Plotting<br />
plot(meanBuffer, "Mean", color.white)<br />
//plot(meanBuffer + (stdChannel1 * currentStdDev), "1st Std up", color.white)<br />
//plot(meanBuffer - (stdChannel1 * currentStdDev), "1st Std down", color.white)<br />
//plot(meanBuffer + (stdChannel2 * currentStdDev), "2nd Std up", color.white)<br />
//plot(meanBuffer - (stdChannel2 * currentStdDev), "2nd Std down", color.white)<br />
plot(meanBuffer + (stdChannel3 * currentStdDev), "3rd Std up", color.white)<br />
plot(meanBuffer - (stdChannel3 * currentStdDev), "3rd Std down", color.white)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Monthly Pivot Points", overlay=true)<br />
<br />
// --- Function to get monthly OHLC ---<br />
var float last_month_high = na<br />
var float last_month_low = na<br />
var float last_month_close = na<br />
var float this_month_open = na<br />
<br />
var float P = na<br />
var float S1 = na<br />
var float R1 = na<br />
var float S2 = na<br />
var float R2 = na<br />
var float S3 = na<br />
var float R3 = na<br />
<br />
var int lastMonth = na<br />
newMonth = (month != month[1])<br />
<br />
// Track highest/lowest of previous month<br />
if newMonth<br />
    last_month_close := close[1]<br />
    this_month_open := open<br />
    last_month_high := high[1]<br />
    last_month_low := low[1]<br />
    for i = 1 to 500<br />
        if (month[i] != month)<br />
            last_month_high := math.max(last_month_high, high[i])<br />
            last_month_low := math.min(last_month_low, low[i])<br />
        else<br />
            break<br />
    P := (last_month_high + last_month_low + this_month_open + last_month_close) / 4<br />
    R1 := (2 * P) - last_month_low<br />
    S1 := (2 * P) - last_month_high<br />
    R2 := P + (last_month_high - last_month_low)<br />
    S2 := P - (last_month_high - last_month_low)<br />
    R3 := (2 * P) + (last_month_high - 2 * last_month_low)<br />
    S3 := (2 * P) - ((2 * last_month_high) - last_month_low)<br />
<br />
// Extend pivots through the month<br />
Pline = P<br />
S1line = S1<br />
R1line = R1<br />
S2line = S2<br />
R2line = R2<br />
S3line = S3<br />
R3line = R3<br />
<br />
// Plot lines<br />
plot(Pline, title="Monthly Pivot", color=color.red, linewidth=2)<br />
plot(S1line, title="S1", color=color.blue, linewidth=1)<br />
plot(R1line, title="R1", color=color.green, linewidth=1)<br />
plot(S2line, title="S2", color=color.blue, linewidth=1)<br />
plot(R2line, title="R2", color=color.green, linewidth=1)<br />
plot(S3line, title="S3", color=color.orange, linewidth=1)<br />
plot(R3line, title="R3", color=color.orange, linewidth=1)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Mogalef Bands", overlay=true)<br />
<br />
// === Inputs ===<br />
lp = input.int(25, title="Linear Regression Period")<br />
sp = input.int(30, title="StdDev Period")<br />
<br />
// === Helper function: Linear Regression ===<br />
linear_regression(src, len) =&gt;<br />
    var float slope = na<br />
    var float intercept = na<br />
    float sumX = 0<br />
    float sumY = 0<br />
    float sumXY = 0<br />
    float sumX2 = 0<br />
<br />
    for i = 0 to len - 1<br />
        sumX += i<br />
        sumY += src[i]<br />
        sumXY += i * src[i]<br />
        sumX2 += i * i<br />
<br />
    divisor = (len * sumX2 - sumX * sumX)<br />
    slope := divisor == 0 ? 0 : (len * sumXY - sumX * sumY) / divisor<br />
    intercept := (sumY - slope * sumX) / len<br />
<br />
    // Value at bar zero (most recent)<br />
    intercept + slope * (len - 1)<br />
<br />
// === Build arrays for LinReg and StdDev ===<br />
var float[] linreg_arr = array.new_float()<br />
var float[] stddev_arr = array.new_float()<br />
<br />
linreg_val = linear_regression(close, lp)<br />
array.unshift(linreg_arr, linreg_val)<br />
if array.size(linreg_arr) &gt; 500<br />
    array.pop(linreg_arr)<br />
<br />
stddev_val = ta.stdev(array.get(linreg_arr, 0), sp)<br />
array.unshift(stddev_arr, stddev_val)<br />
if array.size(stddev_arr) &gt; 500<br />
    array.pop(stddev_arr)<br />
<br />
// === Calculate bands ===<br />
hiband = linreg_val + stddev_val * 2<br />
loband = linreg_val - stddev_val * 2<br />
median = (hiband + loband) / 2<br />
<br />
// === Apply the Mogalef override logic ===<br />
hiband_prev = nz(hiband[1])<br />
loband_prev = nz(loband[1])<br />
linreg_prev = nz(linreg_val[1])<br />
<br />
hiband := (linreg_val &lt; hiband_prev and linreg_val &gt; loband_prev) ? hiband_prev : hiband<br />
loband := (linreg_val &lt; hiband_prev and linreg_val &gt; loband_prev) ? loband_prev : loband<br />
median := (hiband + loband) / 2<br />
<br />
// === Plot bands ===<br />
plot(hiband, color=color.red, title="Upper Band", style=plot.style_line)<br />
plot(loband, color=color.green, title="Lower Band", style=plot.style_line)<br />
plot(median, color=color.blue, title="Median", style=plot.style_line)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("MA Channels FiboEnv Mid", overlay=true)<br />
<br />
// === INPUT PARAMETERS ===<br />
barsCount     = input.int(1000, title="Bars Count")<br />
maPeriod      = input.int(55, title="MA Period")<br />
maType        = input.string("SMA", title="MA Type", options=["SMA", "EMA", "SMMA", "LWMA"])<br />
priceSource   = input.string("Median", title="Price Source", options=["Close", "Open", "High", "Low", "Median", "Typical", "Weighted"])<br />
maShift       = input.int(0, title="MA Shift")<br />
<br />
// === PRICE SOURCE ===<br />
src = switch priceSource<br />
    "Close" =&gt; close<br />
    "Open" =&gt; open<br />
    "High" =&gt; high<br />
    "Low" =&gt; low<br />
    "Median" =&gt; hl2<br />
    "Typical" =&gt; (high + low + close) / 3<br />
    "Weighted" =&gt; (high + low + close + close) / 4<br />
<br />
// === MA FUNCTION ===<br />
getMA(source, length) =&gt;<br />
    switch maType<br />
        "SMA" =&gt; ta.sma(source, length)<br />
        "EMA" =&gt; ta.ema(source, length)<br />
        "SMMA" =&gt; ta.rma(source, length)<br />
        "LWMA" =&gt; ta.wma(source, length)<br />
<br />
// === CALCULATE RANGE OVER LAST barsCount BARS ===<br />
var float maxDev = na<br />
var float minDev = na<br />
<br />
if bar_index &gt;= barsCount + maPeriod<br />
    maxDev := 0.0<br />
    minDev := 0.0<br />
    for i = 0 to barsCount<br />
        ma_i = getMA(src[i], maPeriod)<br />
        top = high[i] - ma_i<br />
        bottom = low[i] - ma_i<br />
        maxDev := math.max(maxDev, top)<br />
        minDev := math.min(minDev, bottom)<br />
<br />
// === FIBO OFFSETS ===<br />
inc4 = math.abs(maxDev) &gt; math.abs(minDev) ? maxDev : minDev<br />
inc1 = (maxDev - minDev) * 0.118<br />
inc2 = (maxDev - minDev) * 0.264<br />
inc3 = (maxDev - minDev) * 0.5<br />
<br />
// === BASE MA ===<br />
baseMA = getMA(src[maShift], maPeriod)<br />
<br />
// === CHANNEL LEVELS ===<br />
fibUp100 = baseMA + inc3<br />
fibDn23  = baseMA + inc2<br />
fibDn38  = baseMA + inc1<br />
fib50    = baseMA<br />
fibUp38  = baseMA - inc1<br />
fibUp23  = baseMA - inc2<br />
fibDn100 = baseMA - inc3<br />
<br />
// === PLOT ===<br />
plot(fibUp100, title="FibMA Up 100%", color=color.purple)<br />
plot(fibDn23,  title="FibMA Down 23.5%", color=color.purple)<br />
plot(fibDn38,  title="FibMA Down 38.2 / Up 61.8%", color=color.purple)<br />
plot(fib50,    title="FibMA 50%", color=color.purple)<br />
plot(fibUp38,  title="FibMA Up 38.2 / Down 61.8%", color=color.purple)<br />
plot(fibUp23,  title="FibMA Up 23.5%", color=color.purple)<br />
plot(fibDn100, title="FibMA Down 100%", color=color.purple)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("BB-HL", overlay=true)<br />
<br />
// === INPUTS ===<br />
per   = input.int(200, title="Period")<br />
nDev  = input.float(2.0, title="Deviation Multiplier")<br />
<br />
// === CALCULATIONS ===<br />
medianPrice = hl2<br />
ma = ta.sma(medianPrice, per)<br />
<br />
// Compute squared deviation using max of High and Low deviation from MA<br />
highDev = math.pow(high - ma, 2)<br />
lowDev  = math.pow(low - ma, 2)<br />
devMax  = math.max(highDev, lowDev)<br />
<br />
// Rolling average of max squared deviation<br />
devAvg = 0.0<br />
devSum = 0.0<br />
<br />
// Use a manual loop to simulate rolling sum of devMax<br />
var float[] devBuffer = array.new_float()<br />
<br />
// Update the buffer each bar<br />
if bar_index &gt; 0<br />
    array.push(devBuffer, devMax)<br />
    if array.size(devBuffer) &gt; per<br />
        array.shift(devBuffer)<br />
<br />
// Compute rolling average from buffer<br />
if array.size(devBuffer) &gt;= per<br />
    for i = 0 to array.size(devBuffer) - 1<br />
        devSum := devSum + array.get(devBuffer, i)<br />
    devAvg := devSum / per<br />
<br />
// Standard deviation and bands<br />
stdev = math.sqrt(devAvg)<br />
upper = ma + nDev * stdev<br />
lower = ma - nDev * stdev<br />
<br />
// === PLOTS ===<br />
plot(ma, title="MA", color=color.orange)<br />
plot(upper, title="Upper Band", color=color.silver)<br />
plot(lower, title="Lower Band", color=color.silver)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("ATR Channels", overlay=true)<br />
<br />
// === INPUTS ===<br />
PeriodsATR   = input.int(18, title="ATR Period")<br />
MA_Periods   = input.int(49, title="MA Period")<br />
MA_type_opt  = input.string("SMA", title="MA Type", options=["SMA", "EMA", "WMA", "VWMA"])<br />
Mult_Factor1 = input.float(1.6, title="Multiplier 1")<br />
Mult_Factor2 = input.float(3.2, title="Multiplier 2")<br />
Mult_Factor3 = input.float(4.8, title="Multiplier 3")<br />
<br />
// === HELPER FUNCTIONS ===<br />
get_ma(src, len) =&gt;    MA_type_opt == "SMA"  ? ta.sma(src, len) :    MA_type_opt == "EMA"  ? ta.ema(src, len) :    MA_type_opt == "WMA"  ? ta.wma(src, len) :    MA_type_opt == "VWMA" ? ta.vwma(src, len) :    na<br />
<br />
// === CORE CALCULATIONS ===<br />
src = hlc3<br />
atr = ta.atr(PeriodsATR)<br />
ma = get_ma(src, MA_Periods)<br />
<br />
// === CHANNEL LEVELS ===<br />
ch1_upper = ma + Mult_Factor1 * atr<br />
ch1_lower = ma - Mult_Factor1 * atr<br />
ch2_upper = ma + Mult_Factor2 * atr<br />
ch2_lower = ma - Mult_Factor2 * atr<br />
ch3_upper = ma + Mult_Factor3 * atr<br />
ch3_lower = ma - Mult_Factor3 * atr<br />
<br />
// === PLOT ===<br />
// Only the outermost bands are visible (like in your MQL4 indicator)<br />
plot(ch3_upper, title="ATRu3", color=color.purple, linewidth=1)<br />
plot(ch3_lower, title="ATRd3", color=color.purple, linewidth=1)<br />
<br />
// Optional: Uncomment below to show inner bands too<br />
//plot(ch1_upper, title="ATRu1", color=color.aqua, linewidth=1)<br />
//plot(ch1_lower, title="ATRd1", color=color.aqua, linewidth=1)<br />
//plot(ch2_upper, title="ATRu2", color=color.blue, linewidth=1)<br />
//plot(ch2_lower, title="ATRd2", color=color.blue, linewidth=1)<br />
<br />
// Optional: Plot the moving average line<br />
//plot(ma, title="Moving Average", color=color.green)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("TD Sequential", overlay=true)<br />
<br />
var int numDown = 0<br />
var int numUp = 0<br />
<br />
pointSize = syminfo.mintick<br />
<br />
// Recalculate TD counts<br />
if close[1] &lt; close[5]<br />
    numDown += 1<br />
else<br />
    numDown := 0<br />
<br />
if close[1] &gt; close[5]<br />
    numUp += 1<br />
else<br />
    numUp := 0<br />
<br />
// Display Sell Setup (Down Count)<br />
if (numDown &gt; 0 and numDown &lt; 10)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text=str.tostring(numDown), style=label.style_label_down, textcolor=color.red, size=size.small)<br />
else if (numDown == 9)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text="9", style=label.style_label_down, textcolor=color.red, size=size.normal)<br />
else if (close[1] &lt; close[5] and numDown &gt;= 10)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text=str.tostring(numDown), style=label.style_label_down, textcolor=color.orange, size=size.small)<br />
<br />
// Display Buy Setup (Up Count)<br />
if (numUp &gt; 0 and numUp &lt; 10)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text=str.tostring(numUp), style=label.style_label_up, textcolor=color.blue, size=size.small)<br />
else if (numUp == 9)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text="9", style=label.style_label_up, textcolor=color.blue, size=size.normal)<br />
else if (close[1] &gt; close[5] and numUp &gt;= 10)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text=str.tostring(numUp), style=label.style_label_up, textcolor=color.aqua, size=size.small)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("CyAn 1 FT", overlay=false)<br />
<br />
// === Input Parameters ===<br />
lenth = input.int(5, title="Length")<br />
maxbars = input.int(2000, title="Max Bars (not used in Pine)")<br />
<br />
// === Recursive Buffers ===<br />
var float aux_prev = 0.0<br />
var float fish_prev = 0.0<br />
<br />
// === Stochastic %K Calculation ===<br />
k = ta.stoch(close, high, low, lenth)<br />
<br />
// === Safe recursive update ===<br />
var float aux = na<br />
var float fish = na<br />
<br />
if bar_index &gt; lenth<br />
    aux := 0.5 * ((k / 100.0 - 0.5) * 2) + 0.5 * aux_prev<br />
    fish := 0.25 * math.log((1 + aux) / (1 - aux)) + 0.5 * fish_prev<br />
    aux_prev := aux<br />
    fish_prev := fish<br />
<br />
// === Signal Line (1 bar lag) ===<br />
signal = nz(fish[1])<br />
<br />
// === Plotting ===<br />
plot(aux, title="Aux", color=color.yellow, linewidth=2)<br />
//plot(signal, title="Signal", color=color.red, linewidth=1)<br />
hline(0.8, "Upper Level", color=color.yellow, linestyle=hline.style_dotted)<br />
hline(-0.8, "Lower Level", color=color.yellow, linestyle=hline.style_dotted)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("DVI_ValueChart", overlay=false)<br />
<br />
var float dvi = na<br />
midpoint = (high + low + high[1] + low[1] + high[2] + low[2] + high[3] + low[3] + high[4] + low[4]) / 10<br />
<br />
dvu = (volume * (high - low) + volume[1] * (high[1] - low[1]) + volume[2] * (high[2] - low[2]) + volume[3] * (high[3] - low[3]) + volume[4] * (high[4] - low[4])) / 5 * 0.02<br />
<br />
dv = volume * ((close - midpoint) / midpoint)<br />
dv := dvu != 0 ? dv / dvu : 0<br />
<br />
dvi := na(dvi[1]) ? dv : dvi[1] + dv<br />
<br />
plot(dvi, title="DVI_ValueChart", color=color.aqua, linewidth=1)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Spud 2 (fixed)", overlay=false, max_bars_back=1000)<br />
<br />
// Inputs<br />
Per = input.int(15, minval=5, title="Period (must be multiple of 5)")<br />
Pk = input.int(5, title="Pk")<br />
Pd = input.int(3, title="Pd")<br />
Ps = input.int(3, title="Ps")<br />
<br />
factor = Per / 5<br />
<br />
// Custom Stochastic Calculation on current bar using past bars only<br />
customStoch() =&gt;<br />
    sumlo = 0.0<br />
    sumhi = 0.0<br />
    for j = 0 to Ps - 1<br />
        barsBack = j * (Per / timeframe.multiplier)<br />
        if barsBack &lt;= bar_index<br />
            clos1 = close[barsBack]<br />
            pkLength = int(Pk * factor)<br />
            highestHigh = ta.highest(high, pkLength)[barsBack]<br />
            lowestLow = ta.lowest(low, pkLength)[barsBack]<br />
            sumlo += clos1 - lowestLow<br />
            sumhi += highestHigh - lowestLow<br />
    sumhi &lt;= 0 ? 100 : (sumlo / sumhi) * 100<br />
<br />
// Linear regression on series data<br />
lreg_series(buffer, length) =&gt;<br />
    if length &lt;= 1<br />
        na<br />
    else<br />
        Sx = 0.0<br />
        Sy = 0.0<br />
        Sxx = 0.0<br />
        Sxy = 0.0<br />
        for i = 0 to length - 1<br />
            x = i * 1.0<br />
            y = buffer[i]<br />
            Sx += x<br />
            Sy += y<br />
            Sxx += x * x<br />
            Sxy += x * y<br />
        n = length * 1.0<br />
        c = Sxx * n - Sx * Sx<br />
        if c == 0<br />
            na<br />
        else<br />
            beta = (n * Sxy - Sx * Sy) / c<br />
            alpha = (Sy - beta * Sx) / n<br />
            alpha<br />
<br />
// Calculate SBuffer for current bar<br />
SBuffer = customStoch()<br />
<br />
// Calculate MaBuffer as linear regression of SBuffer over last Pd bars<br />
MaBuffer = bar_index &gt;= Pd - 1 ? lreg_series(SBuffer, Pd) : na<br />
<br />
// Plot<br />
//plot(SBuffer, color=color.gray, title="Stoch")<br />
plot(MaBuffer, color=color.red, title="Ma")</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("TSI", overlay=false)<br />
<br />
First_R = input.int(5, title="First EMA Period")<br />
Second_S = input.int(8, title="Second EMA Period")<br />
<br />
// Momentum (MTM)<br />
mtm = close - close[1]<br />
abs_mtm = math.abs(mtm)<br />
<br />
// First smoothing<br />
ema_mtm = ta.ema(mtm, First_R)<br />
ema_abs_mtm = ta.ema(abs_mtm, First_R)<br />
<br />
// Second smoothing<br />
ema2_mtm = ta.ema(ema_mtm, Second_S)<br />
ema2_abs_mtm = ta.ema(ema_abs_mtm, Second_S)<br />
<br />
// TSI Calculation<br />
tsi = 100 * ema2_mtm / ema2_abs_mtm<br />
<br />
plot(tsi, title="TSI", color=color.yellow, linewidth=2)<br />
hline(0, "Zero Line", color=color.gray)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Stochastic RSI [Ehlers]", overlay=false)<br />
<br />
// === Input Parameters ===<br />
rsiLength = input.int(5, title="RSI Length")<br />
stocLength = input.int(5, title="Stochastic Length")<br />
wmaLength = input.int(5, title="WMA Length")<br />
<br />
// === Step 1: Calculate RSI ===<br />
rsi = ta.rsi(close, rsiLength)<br />
<br />
// === Step 2: Calculate Highest High and Lowest Low of RSI over Stochastic Length ===<br />
hh = ta.highest(rsi, stocLength)<br />
ll = ta.lowest(rsi, stocLength)<br />
<br />
// === Step 3: Normalize RSI into Stochastic RSI ===<br />
value1 = rsi - ll<br />
value2 = hh - ll<br />
value3 = value2 != 0 ? value1 / value2 : 0.0<br />
<br />
// === Step 4: Smooth with WMA and scale ===<br />
smoothed = ta.wma(value3, wmaLength)<br />
stocRSI = 2.0 * (smoothed - 0.5)<br />
trigger = stocRSI[1]<br />
<br />
// === Plotting ===<br />
plot(stocRSI, title="Stochastic RSI", color=color.red)<br />
plot(trigger, title="Trigger", color=color.blue)<br />
hline(0, color=color.gray, linestyle=hline.style_dotted)<br />
hline(1, "Upper", color=color.gray, linestyle=hline.style_dashed)<br />
hline(-1, "Lower", color=color.gray, linestyle=hline.style_dashed)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Anchored VWAP with Deviation Bands", overlay=true)<br />
<br />
show_custom = input.bool(true, "Show Custom")<br />
startfrom = input.time(timestamp("01 Jan 2020 00:00 +0000"), "Start From")<br />
deviation_band_1 = input.float(1.0, "Deviation Band 1")<br />
<br />
// Anchored region<br />
var float cum_vp = na<br />
var float cum_vol = na<br />
<br />
// Reset at the anchor point<br />
if (na(cum_vol))<br />
    cum_vp := 0.0<br />
    cum_vol := 0.0<br />
<br />
is_after_start = time &gt;= startfrom<br />
<br />
vp = volume * hlc3<br />
<br />
cum_vp := is_after_start ? cum_vp + vp : na<br />
cum_vol := is_after_start ? cum_vol + volume : na<br />
<br />
anchored_vwap = is_after_start and cum_vol != 0 ? cum_vp / cum_vol : na<br />
<br />
// Store historical VWAP for deviation calculation<br />
var float[] vwap_series = array.new_float()<br />
<br />
if is_after_start<br />
    array.unshift(vwap_series, anchored_vwap)<br />
    if array.size(vwap_series) &gt; bar_index<br />
        array.pop(vwap_series)<br />
<br />
// Calculate standard deviation from the anchored point<br />
var float std_dev = na<br />
if is_after_start and array.size(vwap_series) &gt; 1<br />
    float mean = anchored_vwap<br />
    float sum_sq_diff = 0.0<br />
    for i = 0 to array.size(vwap_series) - 1<br />
        float val = array.get(vwap_series, i)<br />
        sum_sq_diff += math.pow(val - mean, 2)<br />
    std_dev := math.sqrt(sum_sq_diff / array.size(vwap_series))<br />
<br />
upper_band = show_custom and not na(anchored_vwap) ? anchored_vwap + deviation_band_1 * std_dev : na<br />
lower_band = show_custom and not na(anchored_vwap) ? anchored_vwap - deviation_band_1 * std_dev : na<br />
<br />
plot(upper_band, color=color.red, title="Upper Band")<br />
plot(lower_band, color=color.red, title="Lower Band")<br />
plot(show_custom ? anchored_vwap : na, color=color.green, title="Anchored VWAP")</code></div></div>]]></description>
			<content:encoded><![CDATA[These indicators have been converted by me and are not available in the public indicators database of tradingview<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="RD.COmbo", shorttitle="RD-Combo", overlay=false,<br />
 max_bars_back=2000, // Sufficient history for calculations, especially ForecastOsc<br />
 precision=2         // Adjust precision for plots if needed<br />
 )<br />
<br />
// --- Input Parameters ---<br />
bool DoAlertForEntry = input.bool(false, "Do Alert For Entry")<br />
bool DoAlertForExit = input.bool(false, "Do Alert For Exit")<br />
// HistorySize in MQL4 primarily limits the `start` loop iteration.<br />
// In Pine Script, plots automatically handle historical data.<br />
// We keep it as an input but it doesn't directly restrict plots.<br />
int HistorySize_input = input.int(1000, "History Size", minval=100)<br />
int ColorThreshold = input.int(5, "Color Threshold", minval=0, maxval=5)<br />
float NoiseFilterRVI = input.float(0.03, "RVI Exit Threshold", minval=0.0, step=0.01) // MQL4 uses 0.2 in condition, but input is 0.03. Using input.<br />
bool DebugLogger = input.bool(false, "Debug Logger (Console)")<br />
bool DebugLoggerData = input.bool(false, "Debug Logger Data (Console)")<br />
<br />
// --- Global variables for Signal State &amp; Alerts ---<br />
// `var` keyword ensures these variables retain their values across bars.<br />
var int signalstate = 0 // 1 = Long, -1 = Short, 0 = Neutral<br />
var bool didentryalert_pine = false<br />
var bool didexitalert_pine = false<br />
<br />
// --- ForecastOscillator Calculation Helper Functions ---<br />
<br />
// Helper function to calculate the weighted sum for `wt`<br />
f_calc_wt(src, len) =&gt;<br />
    float sum_val = 0.0<br />
    // Iterate from the current bar's position `len - i` to access past `src` values.<br />
    // MQL4 `Close[shift+length-i]` corresponds to `src[len - i]` for current bar `shift=0`.<br />
    for i = 1 to len<br />
        float tmp_coeff = i - (float(len) + 1.0) / 3.0<br />
        sum_val += tmp_coeff * src[len - i]<br />
    sum_val * 6.0 / (float(len) * (float(len) + 1.0))<br />
<br />
// ForecastOscillator logic<br />
f_forecast_osc_series(src_series, regress, t3, b) =&gt;<br />
    float b2 = b * b<br />
    float b3 = b2 * b<br />
    float c1 = -b3<br />
    float c2 = (3 * (b2 + b3))<br />
    float c3 = -3 * (2 * b2 + b + b3)<br />
    float c4 = (1 + 3 * b + b3 + 3 * b2)<br />
    float n = 1 + 0.5 * (float(t3) - 1)<br />
    float w1 = 2 / (n + 1)<br />
    float w2 = 1 - w1<br />
<br />
    // Calculate wt for the current bar<br />
    float wt = f_calc_wt(src_series, regress)<br />
<br />
    // Ensure `wt` is not too close to zero to avoid division by zero<br />
    float forecastosc = (src_series - wt) / (math.abs(wt) &lt; 1e-10 ? 1e-10 : wt) * 100<br />
<br />
    // T3 smoothing chain - these variables must persist across bars<br />
    var float e1 = na<br />
    var float e2 = na<br />
    var float e3 = na<br />
    var float e4 = na<br />
    var float e5 = na<br />
    var float e6 = na<br />
    <br />
    // Using nz() to handle initial `na` values<br />
    e1 := w1 * forecastosc + w2 * nz(e1[1])<br />
    e2 := w1 * e1 + w2 * nz(e2[1])<br />
    e3 := w1 * e2 + w2 * nz(e3[1])<br />
    e4 := w1 * e3 + w2 * nz(e4[1])<br />
    e5 := w1 * e4 + w2 * nz(e5[1])<br />
    e6 := w1 * e5 + w2 * nz(e6[1])<br />
    <br />
    float t3_fosc = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3<br />
    <br />
    [forecastosc, t3_fosc] // Return both series<br />
<br />
// --- Pre-calculate Forecast Oscillator values ---<br />
// Call the function on the 'close' series with MQL4's default parameters (15, 3, 0.7)<br />
[Osc, Osct3] = f_forecast_osc_series(close, 15, 3, 0.7)<br />
<br />
<br />
// --- Combo Indicator Logic (Translated from MQL4's Combo function) ---<br />
<br />
// Calculate all necessary indicator values for the current bar.<br />
// MQL4's `lookupidx` corresponds to `[0]` for the current bar in Pine.<br />
float ma5 = ta.wma(close, 5)<br />
float ma20 = ta.wma(close, 20)<br />
float ma100 = ta.wma(close, 100)<br />
float ma200 = ta.wma(close, 200)<br />
<br />
float cci = ta.cci(close, 5)<br />
<br />
// --- MANUAL RVI CALCULATION (REPLACEMENT FOR ta.rvi) ---<br />
// RVI Main (period 1 from MQL4) = (Close - Open) / (High - Low)<br />
float rvi_numerator_raw = close - open<br />
float rvi_denominator_raw = high - low<br />
float rvimain = rvi_denominator_raw != 0 ? rvi_numerator_raw / rvi_denominator_raw : 0.0<br />
<br />
// RVI Signal (period 1 from MQL4 implies a 4-period SMA of the main RVI)<br />
float rvisignal = ta.sma(rvimain, 4)<br />
// --- END MANUAL RVI CALCULATION ---<br />
<br />
<br />
// --- MANUAL ADX/DI CALCULATION (REPLACEMENT FOR ta.adx, ta.plus_di, ta.minus_di) ---<br />
f_calculate_adx_di(len) =&gt;<br />
    // True Range<br />
    tr1 = high - low<br />
    tr2 = math.abs(high - close[1])<br />
    tr3 = math.abs(low - close[1])<br />
    tr = math.max(tr1, tr2, tr3)<br />
<br />
    // Directional Movement<br />
    up = high - high[1]<br />
    down = low[1] - low<br />
<br />
    plusDM = up &gt; down and up &gt; 0 ? up : 0<br />
    minusDM = down &gt; up and down &gt; 0 ? down : 0<br />
<br />
    // Smoothed True Range and Directional Movements using RMA (Wilders Smoothing)<br />
    // ta.rma is the Pine Script equivalent of Wilders Smoothing<br />
    smoothTR = ta.rma(tr, len)<br />
    smoothPlusDM = ta.rma(plusDM, len)<br />
    smoothMinusDM = ta.rma(minusDM, len)<br />
<br />
    // Calculate DI+ and DI-<br />
    plusDI = smoothTR != 0 ? smoothPlusDM / smoothTR * 100 : 0<br />
    minusDI = smoothTR != 0 ? smoothMinusDM / smoothTR * 100 : 0<br />
<br />
    // Calculate DX<br />
    sumDI = plusDI + minusDI<br />
    dx = sumDI != 0 ? math.abs(plusDI - minusDI) / sumDI * 100 : 0<br />
<br />
    // Calculate ADX (smoothed DX)<br />
    adx = ta.rma(dx, len)<br />
    <br />
    [adx, plusDI, minusDI]<br />
<br />
// Apply the manual ADX/DI calculation for period 14<br />
[adxmain, adxplus, adxminus] = f_calculate_adx_di(14)<br />
<br />
// For previous bar values, we can simply use the `[1]` operator on the calculated series<br />
float adxmain2 = adxmain[1]<br />
float adxplus2 = adxplus[1]<br />
float adxminus2 = adxminus[1]<br />
// --- END MANUAL ADX/DI CALCULATION ---<br />
<br />
// Forecast Oscillator values for current bar (already calculated as series `Osc` and `Osct3`)<br />
float fcblue = Osc<br />
float fcred = Osct3<br />
<br />
// Initialize signal components<br />
int maval = 0<br />
int ccival = 0<br />
int rvival = 0<br />
int adxval = 0<br />
int fcval = 0<br />
<br />
// MA signal<br />
if ma5 &gt; ma20<br />
    maval := 1<br />
else if ma5 &lt; ma20<br />
    maval := -1<br />
<br />
// CCI signal<br />
if cci &gt; 0<br />
    ccival := 1<br />
else if cci &lt; 0<br />
    ccival := -1<br />
// Else ccival remains 0<br />
<br />
// Forecast Oscillator signal<br />
if fcblue &gt; 0 and fcred &gt; 0 and fcblue &gt; fcred<br />
    fcval := 1<br />
else if fcblue &lt; 0 and fcred &lt; 0 and fcblue &lt; fcred<br />
    fcval := -1<br />
// Else fcval remains 0<br />
<br />
// RVI signal<br />
if rvimain &gt; 0 and rvisignal &gt; 0 and rvimain - rvisignal &gt; 0<br />
    rvival := 1<br />
else if rvimain &lt; 0 and rvisignal &lt; 0 and rvimain - rvisignal &lt; 0<br />
    rvival := -1<br />
// Else rvival remains 0<br />
<br />
// ADX signal<br />
if adxmain &gt; adxmain2 and adxplus &gt; adxplus2 and adxmain &gt; 20 and adxplus &gt; 20<br />
    adxval := 1<br />
else if adxmain &gt; adxmain2 and adxminus &gt; adxminus2 and adxmain &gt; 20 and adxminus &gt; 20<br />
    adxval := -1<br />
// Else adxval remains 0<br />
<br />
// Calculate the total combined signal strength<br />
float val = maval + ccival + fcval + rvival + adxval<br />
<br />
// --- Exit Signal Logic ---<br />
// Note: MQL4 used a constant `0.2` for RVI exit threshold, but `NoiseFilterRVI` input was 0.03.<br />
// We are using the `NoiseFilterRVI` input for consistency.<br />
if signalstate != 0<br />
    if signalstate == 1 and (rvimain &lt; 0 or (rvisignal - rvimain) &gt; NoiseFilterRVI)<br />
        signalstate := 0 // Exit long<br />
    if signalstate == -1 and (rvimain &gt; 0 or (rvimain - rvisignal) &gt; NoiseFilterRVI)<br />
        signalstate := 0 // Exit short<br />
<br />
// --- Debugging Output (to Pine Script console) ---<br />
if DebugLogger or DebugLoggerData<br />
    // Check for sufficient historical bars before logging to avoid errors with `[1]` etc.<br />
    if bar_index &gt;= math.max(14, 200) // At least 200 bars for MAs, 14 for ADX. Min 31+regress=46 for FO.<br />
        if DebugLoggerData<br />
            log.info("--------------------------------------------------------------------------")<br />
            log.info("Time: {0}, Bar: {1}, MA 5/20/100/200: {2}/{3}/{4}/{5}",<br />
                 timenow, bar_index, ma5, ma20, ma100, ma200)<br />
            log.info("Time: {0}, Bar: {1}, CCI: {2}, RVI: {3}/{4}",<br />
                 timenow, bar_index, cci, rvimain, rvisignal)<br />
            log.info("Time: {0}, Bar: {1}, ADX(now): {2}/{3}/{4}",<br />
                 timenow, bar_index, adxmain, adxplus, adxminus)<br />
            log.info("Time: {0}, Bar: {1}, ADX(prev): {2}/{3}/{4}",<br />
                 timenow, bar_index, adxmain2, adxplus2, adxminus2)<br />
            log.info("Time: {0}, Bar: {1}, Forecast blue/red: {2}/{3}",<br />
                 timenow, bar_index, fcblue, fcred)<br />
<br />
        log.info("Time: {0}, Bar: {1}, MAtrend({2}) + CCI({3}) + FC({4}) + RVItrend({5}) + ADXtrend({6}) =&gt; {7} # trade state = {8}",<br />
             timenow, bar_index, maval, ccival, fcval, rvival, adxval, val, signalstate)<br />
<br />
<br />
// --- Determine Plot Values ---<br />
// These are the buffers from MQL4 (Neutral, Short, Long, Signal)<br />
float NeutralBuffer_val = 0.0<br />
float LongSignalBuffer_val = 0.0<br />
float ShortSignalBuffer_val = 0.0<br />
<br />
if val &gt;= ColorThreshold<br />
    LongSignalBuffer_val := val<br />
    signalstate := 1 // Set signalstate to long if conditions met<br />
else if val &lt;= -ColorThreshold<br />
    ShortSignalBuffer_val := val<br />
    signalstate := -1 // Set signalstate to short if conditions met<br />
else<br />
    NeutralBuffer_val := val // Neutral, between thresholds<br />
    // If we're neutral, but previously in a signal, it might be an exit condition.<br />
    // The `signalstate` is managed by the exit logic above.<br />
    // So if the current `val` is neutral, but `signalstate` was set by an exit condition, it remains 0.<br />
    // If `val` is neutral and there was no exit, `signalstate` also becomes 0.<br />
    if math.abs(val) &lt; ColorThreshold and signalstate != 0<br />
        signalstate := 0 // If signal goes neutral and no specific RVI exit occurred, also reset.<br />
<br />
<br />
// SignalBuffer: MQL4 uses `2 * signalstate`<br />
float SignalBuffer_val = 2 * signalstate<br />
<br />
// --- Plotting ---<br />
// Removed minval and maxval as they are not recognized in your environment.<br />
// The indicator will now auto-scale based on the values plotted.<br />
plot(NeutralBuffer_val, title="Neutral", color=color.rgb(128, 128, 128), style=plot.style_columns, linewidth=2, histbase=0) // Gray<br />
plot(ShortSignalBuffer_val, title="Short Signal", color=color.rgb(255, 69, 0), style=plot.style_columns, linewidth=2, histbase=0) // OrangeRed<br />
plot(LongSignalBuffer_val, title="Long Signal", color=color.rgb(124, 252, 0), style=plot.style_columns, linewidth=2, histbase=0) // LawnGreen<br />
<br />
plot(SignalBuffer_val, title="Signal Line", color=color.rgb(255, 215, 0), style=plot.style_line, linewidth=1) // Gold<br />
<br />
// Plotting MQL4 levels (4 and -4) - these will still help visually define a range.<br />
hline(4, "Level +4", color.rgb(100, 100, 100), linestyle=hline.style_dashed)<br />
hline(-4, "Level -4", color.rgb(100, 100, 100), linestyle=hline.style_dashed)<br />
<br />
<br />
// --- Alerting Logic ---<br />
// MQL4: `SignalBuffer[0]!=0 &amp;&amp; SignalBuffer[1]==0` for entry<br />
// Pine: `SignalBuffer_val != 0 and SignalBuffer_val[1] == 0` for entry<br />
if DoAlertForEntry and SignalBuffer_val != 0 and nz(SignalBuffer_val[1]) == 0<br />
    if not didentryalert_pine<br />
        alert("RD signals trade entry on " + syminfo.ticker + "/" + timeframe.period, alert.freq_once_per_bar)<br />
        didentryalert_pine := true<br />
else<br />
    didentryalert_pine := false // Reset alert flag when no entry signal<br />
<br />
// MQL4: `SignalBuffer[0]==0 &amp;&amp; SignalBuffer[1]!=0` for exit<br />
// Pine: `SignalBuffer_val == 0 and SignalBuffer_val[1] != 0` for exit<br />
if DoAlertForExit and SignalBuffer_val == 0 and nz(SignalBuffer_val[1]) != 0<br />
    if not didexitalert_pine<br />
        alert("RD signals trade exit on " + syminfo.ticker + "/" + timeframe.period, alert.freq_once_per_bar)<br />
        didexitalert_pine := true<br />
else<br />
    didexitalert_pine := false // Reset alert flag when no exit signal</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="Weekly Pivot", shorttitle="WeeklyPivot", overlay=true)<br />
<br />
//--- Global variables for pivot values (will retain their value across bars)<br />
var float P_val  = na<br />
var float S1_val = na<br />
var float R1_val = na<br />
var float S2_val = na<br />
var float R2_val = na<br />
var float S3_val = na<br />
var float R3_val = na<br />
<br />
//--- Global variables for labels (will hold label IDs)<br />
var label P_label  = na<br />
var label S1_label = na<br />
var label R1_label = na<br />
var label S2_label = na<br />
var label R2_label = na<br />
var label S3_label = na<br />
var label R3_label = na<br />
<br />
// --- Input for font size (from MQL4's fontsize)<br />
var int fontsize_input = input.int(10, "Label Font Size", minval=6, maxval=24)<br />
<br />
// --- Detect start of a new week (typically Monday, first bar of the week)<br />
// `ta.change(time("W"))` returns true on the first bar of a new weekly period.<br />
new_week = ta.change(time("W"))<br />
<br />
// --- Get previous week's data<br />
// request.security is used to fetch historical High, Low, and Close from the *completed* previous week.<br />
// `[1]` refers to the previous weekly bar.<br />
// `lookahead=barmerge.lookahead_on` ensures we get the value from the *closed* previous week.<br />
[prev_w_high, prev_w_low, prev_w_close] = request.security(syminfo.tickerid, "W", [high[1], low[1], close[1]], lookahead=barmerge.lookahead_on)<br />
<br />
// --- Main Calculation: Calculate pivots only on the first bar of a new week ---<br />
if new_week<br />
    // The current bar's open is the open of the new week.<br />
    current_week_open = open<br />
<br />
    // Calculate Pivot Points based on the MQL4 formula:<br />
    // P = (Previous Week High + Previous Week Low + Current Week Open + Previous Week Close) / 4<br />
    P_val  := (prev_w_high + prev_w_low + current_week_open + prev_w_close) / 4<br />
    R1_val := (2 * P_val) - prev_w_low<br />
    S1_val := (2 * P_val) - prev_w_high<br />
    R2_val := P_val + (prev_w_high - prev_w_low)<br />
    S2_val := P_val - (prev_w_high - prev_w_low)<br />
    R3_val := (2 * P_val) + (prev_w_high - (2 * prev_w_low))<br />
    S3_val := (2 * P_val) - ((2 * prev_w_high) - prev_w_low)<br />
<br />
    // --- Create/Update Labels for Pivot Levels ---<br />
    // If labels don't exist yet (first run of script, or after reset), create them.<br />
    // Otherwise, update their position and value.<br />
    if na(P_label) // Check if the main pivot label is 'na' to know if all labels need creating<br />
        // Create labels with transparent background (`color.new(color.white, 100)`)<br />
        P_label  := label.new(x=time, y=P_val, text="Weekly Pivot Point", xloc=xloc.bar_time, yloc=yloc.price,<br />
                             color=color.new(color.white, 100), textcolor=color.rgb(255, 0, 255), size=size.small, style=label.style_label_left) // Magenta<br />
        S1_label := label.new(x=time, y=S1_val, text="wS 1", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(65, 105, 225), size=size.small, style=label.style_label_left) // RoyalBlue<br />
        R1_label := label.new(x=time, y=R1_val, text="wR 1", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(220, 20, 60), size=size.small, style=label.style_label_left) // Crimson<br />
        S2_label := label.new(x=time, y=S2_val, text="wS 2", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(65, 105, 225), size=size.small, style=label.style_label_left) // RoyalBlue<br />
        R2_label := label.new(x=time, y=R2_val, text="wR 2", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(220, 20, 60), size=size.small, style=label.style_label_left) // Crimson<br />
        S3_label := label.new(x=time, y=S3_val, text="wS 3", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(46, 139, 87), size=size.small, style=label.style_label_left) // SeaGreen<br />
        R3_label := label.new(x=time, y=R3_val, text="wR 3", xloc=xloc.bar_time, yloc=yloc.price,<br />
                              color=color.new(color.white, 100), textcolor=color.rgb(46, 139, 87), size=size.small, style=label.style_label_left) // SeaGreen<br />
    <br />
    // Update labels (for existing ones, and for newly created ones on the same bar)<br />
    label.set_xy(P_label, x=time, y=P_val)<br />
    label.set_xy(S1_label, x=time, y=S1_val)<br />
    label.set_xy(R1_label, x=time, y=R1_val)<br />
    label.set_xy(S2_label, x=time, y=S2_val)<br />
    label.set_xy(R2_label, x=time, y=R2_val)<br />
    label.set_xy(S3_label, x=time, y=S3_val)<br />
    label.set_xy(R3_label, x=time, y=R3_val)<br />
<br />
    // Update label text if you want to include values (MQL4 only used fixed text)<br />
    // For example: `label.set_text(P_label, "Weekly Pivot Point: " + str.tostring(P_val))`<br />
    // But sticking to MQL4 original, fixed text is used.<br />
<br />
    // Update font size (MQL4 only sets this on init, but we can make it dynamic here if desired)<br />
    // For a constant font size, it's better to pass it directly to label.new and avoid updating every week.<br />
    // However, if we added an input for fontsize, we would set it here.<br />
    // Example: label.set_size(P_label, f_get_label_size(fontsize_input))<br />
    // For now, size.small is hardcoded based on MQL4's fontsize=10.<br />
<br />
// --- Plotting the Pivot Lines ---<br />
// The `P_val`, `S1_val`, etc. variables retain their last calculated value thanks to `var`.<br />
// This makes them horizontal lines spanning the entire week until a new calculation occurs.<br />
<br />
plot(P_val,  title="Weekly Pivot Point", color=color.rgb(255, 0, 255), linewidth=2, style=plot.style_line) // Magenta<br />
plot(S1_val, title="W_S 1",              color=color.rgb(65, 105, 225), linewidth=2, style=plot.style_line) // RoyalBlue<br />
plot(R1_val, title="W_R 1",              color=color.rgb(220, 20, 60),  linewidth=2, style=plot.style_line) // Crimson<br />
plot(S2_val, title="W_S 2",              color=color.rgb(65, 105, 225), linewidth=2, style=plot.style_line) // RoyalBlue<br />
plot(R2_val, title="W_R 2",              color=color.rgb(220, 20, 60),  linewidth=2, style=plot.style_line) // Crimson<br />
plot(S3_val, title="W_S 3",              color=color.rgb(46, 139, 87),  linewidth=2, style=plot.style_line) // SeaGreen<br />
plot(R3_val, title="W_R 3",              color=color.rgb(46, 139, 87),  linewidth=2, style=plot.style_line) // SeaGreen</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator(title="Weighted WCCI", shorttitle="Weighted WCCI", overlay=false)<br />
<br />
//--- Input Parameters ---<br />
TCCIp       = input.int(7, "Turbo CCI Period", minval=1)<br />
CCIp        = input.int(13, "CCI Period", minval=1)<br />
overbslevel = input.float(200.0, "Overbought/Oversold Level")<br />
triglevel   = input.float(50.0, "Trigger Level")<br />
weight      = input.float(1.0, "Weight")<br />
<br />
//--- Pine Script Buffers (variables for plotting) ---<br />
var float ExtMapBuffer1 = na // Turbo CCI (Red)<br />
var float ExtMapBuffer2 = na // CCI (DodgerBlue)<br />
var float ExtMapBuffer3 = na // CCI Histogram (CadetBlue)<br />
var float ExtMapBuffer4 = na // Overbought Level (Red)<br />
var float ExtMapBuffer5 = na // Oversold Level (Red)<br />
var float ExtMapBuffer6 = na // Trigger Level (RoyalBlue)<br />
var float ExtMapBuffer7 = na // Negative Trigger Level (RoyalBlue)<br />
var float ExtMapBuffer8 = na // Zero Level (PaleGreen)<br />
<br />
//--- Global variables for trend tracking (mimicking MQL4's trend_counter and trend string) ---<br />
var int trend_counter = 0<br />
var string trend = "ZERO"<br />
<br />
//--- Main Calculation ---<br />
// MQL4's iCCI(NULL,0,Period,PRICE_TYPICAL,shift) translates to ta.cci(hlc3, Period)[shift]<br />
// MQL4's iATR(NULL,0,Period,shift) translates to ta.atr(Period)[shift]<br />
<br />
// Calculate CCI and Turbo CCI for the current bar (shift = 0 in MQL4)<br />
float currentCCI  = ta.cci(hlc3, CCIp)<br />
float currentTCCI = ta.cci(hlc3, TCCIp)<br />
<br />
// Calculate ATR for the current bar (shift = 0 in MQL4)<br />
float atr7  = ta.atr(7)<br />
float atr49 = ta.atr(49)<br />
<br />
float Kw = 0.0<br />
<br />
if weight == 0<br />
    Kw := 0.0<br />
else<br />
    Kw := weight * (atr7 / atr49)<br />
    currentCCI  := currentCCI * Kw<br />
    currentTCCI := currentTCCI * Kw<br />
<br />
// Clamp values as per MQL4 logic<br />
if currentTCCI &gt; overbslevel + 50<br />
    currentTCCI := overbslevel + 50<br />
if currentCCI &gt; overbslevel + 50<br />
    currentCCI := overbslevel + 50<br />
if currentCCI &lt; -overbslevel - 50<br />
    currentCCI := -overbslevel - 50<br />
if currentTCCI &lt; -overbslevel - 50<br />
    currentTCCI := -overbslevel - 50<br />
<br />
// Assign values to plotting variables<br />
ExtMapBuffer1 := currentTCCI<br />
ExtMapBuffer2 := currentCCI<br />
ExtMapBuffer3 := currentCCI // Used for histogram<br />
ExtMapBuffer4 := overbslevel<br />
ExtMapBuffer5 := -overbslevel<br />
ExtMapBuffer6 := triglevel<br />
ExtMapBuffer7 := -triglevel<br />
ExtMapBuffer8 := 0.0<br />
<br />
// --- Trend Logic (for comment only) ---<br />
// Pine Script executes on every bar, so we handle previous bar state with `[1]` or `var` variables.<br />
// The MQL4 `shift==0` logic applies to the current bar.<br />
if barstate.islast<br />
    // Let's replicate the MQL4 logic as closely as possible for the `trend` string and `trend_counter`.<br />
    // It is important to note that MQL4's `trend` variable is a global.<br />
    // In Pine, `var` ensures persistence across bars.<br />
<br />
    if currentCCI &gt; 0<br />
        if trend[1] == "UP" // Using [1] to get the value from the *previous* bar<br />
            trend_counter := trend_counter[1] + 1<br />
        else<br />
            trend_counter := 1<br />
            trend := "UP"<br />
    else if currentCCI &lt; 0 // Assuming MQL4 implied `currentCCI &lt; 0` for "DOWN"<br />
        if trend[1] == "DOWN"<br />
            trend_counter := trend_counter[1] + 1<br />
        else<br />
            trend_counter := 1<br />
            trend := "DOWN"<br />
    else // currentCCI == 0 or very close<br />
        trend_counter := 1<br />
        trend := "ZERO"<br />
<br />
    // The MQL4 'Comment' function for status bar text is removed for Pine compatibility<br />
    // You can see the `trend` and `trend_counter` values in the Data Window when hovering over the indicator.<br />
<br />
<br />
//--- Plotting ---<br />
// Plot 0: Turbo CCI<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer1, title="Turbo CCI", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1)<br />
<br />
// Plot 1: CCI<br />
// Changed color.dodgerBlue to color.rgb(30, 144, 255)<br />
plot(ExtMapBuffer2, title="CCI", color=color.rgb(30, 144, 255), style=plot.style_line, linewidth=3)<br />
<br />
// Plot 2: CCI Histogram<br />
// Changed color.cadetBlue to color.rgb(95, 158, 160)<br />
plot(ExtMapBuffer3, title="CCI Histogram", color=color.rgb(95, 158, 160), style=plot.style_columns)<br />
<br />
// Plot 3: Overbought Level (Red)<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer4, title="Overbought Level", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 4: Oversold Level (Red)<br />
// Changed color.red to color.rgb(255, 0, 0)<br />
plot(ExtMapBuffer5, title="Oversold Level", color=color.rgb(255, 0, 0), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 5: Trigger Level (RoyalBlue)<br />
// Changed color.royalBlue to color.rgb(65, 105, 225)<br />
plot(ExtMapBuffer6, title="Trigger Level (+)", color=color.rgb(65, 105, 225), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 6: Negative Trigger Level (RoyalBlue)<br />
// Changed color.royalBlue to color.rgb(65, 105, 225)<br />
plot(ExtMapBuffer7, title="Trigger Level (-)", color=color.rgb(65, 105, 225), style=plot.style_line, linewidth=1, show_last=5000)<br />
<br />
// Plot 7: Zero Level (PaleGreen)<br />
// Changed color.paleGreen to color.rgb(152, 251, 152)<br />
plot(ExtMapBuffer8, title="Zero Level", color=color.rgb(152, 251, 152), style=plot.style_line, linewidth=1, show_last=5000)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("SwamiRSI_v1", shorttitle="SwamiRSI_v1", overlay=false)<br />
<br />
//--- Input Parameters ---<br />
var int g_visualMode  = input.int(0, "Visual Mode (0=original, 1=trend)", minval=0, maxval=1)<br />
var int g_priceType   = input.int(0, "Applied Price (0=Close, 1=Open, 2=High, 3=Low, 4=Median, 5=Typical; 6=Weighted)", minval=0, maxval=6)<br />
var int g_startLength = input.int(12, "RSI Start Period", minval=1)<br />
var int g_endLength   = input.int(48, "RSI End Period", minval=1)<br />
var int g_sampleLength = input.int(48, "Sample RSI Period (0=off)", minval=0)<br />
var int g_smooth      = input.int(5, "Smoothing Period", minval=1)<br />
var color g_upTrendColor  = input.color(color.lime, "UpTrend Color")<br />
var color g_dnTrendColor  = input.color(color.red, "DownTrend Color")<br />
var color g_flatColor     = input.color(color.yellow, "Flat Color (if CLR_NONE, 2 Color Mix)")<br />
var int g_scaleMode   = input.int(1, "Scale Mode (0=J.Ehlers, 1=0...100)", minval=0, maxval=1)<br />
var int g_swamiBars   = input.int(100, "Swami Bars (-1=off, 0=all Bars, &gt;0=any number)")<br />
<br />
// --- Helper Functions ---<br />
<br />
// Get applied price based on input<br />
f_get_price(priceType) =&gt;<br />
    switch priceType<br />
        0 =&gt; close<br />
        1 =&gt; open<br />
        2 =&gt; high<br />
        3 =&gt; low<br />
        4 =&gt; (high + low) / 2<br />
        5 =&gt; (high + low + close) / 3<br />
        6 =&gt; (open + high + low + close) / 4<br />
        =&gt; close // Default to close if invalid type<br />
<br />
// Custom EMA function to mimic MQL4 behavior more closely<br />
// It stores previous EMA value in a separate buffer for state management across bars<br />
// `ema_array`: an array that stores the previous EMA value for each 'index' (used by MQL4's ema[][2])<br />
// `price_val`: the current price value for the EMA calculation<br />
// `period`: the EMA period<br />
// `idx`: the index within the ema_array to store the value (corresponds to MQL4's `index` argument)<br />
f_ema(ema_array, price_val, period, idx) =&gt;<br />
    prev_ema_val = array.get(ema_array, idx)<br />
    current_ema_val = if bar_index == 0 or na(prev_ema_val)<br />
        price_val<br />
    else<br />
        prev_ema_val + 1.0 / period * (price_val - prev_ema_val)<br />
    array.set(ema_array, idx, current_ema_val)<br />
    current_ema_val<br />
<br />
// Custom _RSI calculation (mimics MQL4 logic)<br />
// `index`: corresponds to the 'i' in the MQL4 loop, used for array indexing<br />
// `change`: current price change (price[0] - price[1])<br />
// `period`: RSI period (StartLength + index)<br />
// `ema_array`: array to pass to the f_ema function<br />
// `swamisize`: from MQL4's swamisize global<br />
f_custom_rsi(index, change, period, ema_array, swamisize) =&gt;<br />
    totChg = math.abs(change)<br />
<br />
    // MQL4's EMA function uses `ema[index][0]` and `ema[index][1]`, and `prevtime[index]`<br />
    // Here, we use indices for `ema_array`:<br />
    // NetChgAvg uses `index` (0 to swamisize-1)<br />
    // TotChgAvg uses `index + swamisize`<br />
    // Final RSI EMA uses `index + 2*swamisize`<br />
    netChgAvg = f_ema(ema_array, change, period, index)<br />
    totChgAvg = f_ema(ema_array, totChg, period, index + swamisize)<br />
<br />
    chgRatio = if totChgAvg != 0<br />
        netChgAvg / totChgAvg<br />
    else<br />
        0.0<br />
<br />
    rsiVal = f_ema(ema_array, 2 * chgRatio + 0.5, g_smooth, index + 2 * swamisize)<br />
<br />
    math.max(0, math.min(1, rsiVal)) // Clamp between 0 and 1<br />
<br />
// --- Global Variables (converted from MQL4's global arrays) ---<br />
var float[] g_ema = na // Will be initialized on first bar<br />
var int[] g_trend = na   // Will be initialized on first bar<br />
<br />
var float g_fuzzWidth = na<br />
var float g_maxValue = na<br />
var float g_minValue = na<br />
<br />
var int g_swamisize = na<br />
var float g_priceCurrent = na<br />
var float g_pricePrevious = na<br />
<br />
// --- For Box Management ---<br />
// We need a global array to store all created boxes so we can delete them.<br />
var box[] all_swami_boxes = array.new_box(0)<br />
<br />
// --- Main Calculation ---<br />
g_priceCurrent := f_get_price(g_priceType)<br />
g_pricePrevious := f_get_price(g_priceType)[1] // Price of the previous bar<br />
<br />
// Initialize/resize arrays and set initial values on first bar<br />
if bar_index == 0<br />
    g_swamisize := g_endLength - g_startLength + 1<br />
    // Corrected lines: Directly assign newly created arrays<br />
    g_ema := array.new_float(g_swamisize * 3, na) // Initialize with 'na' values<br />
    g_trend := array.new_int(g_swamisize, 0)     // Initialize with 0s<br />
<br />
    if g_sampleLength &gt; 0<br />
        g_sampleLength := math.max(g_startLength, g_sampleLength)<br />
        g_sampleLength := math.min(g_endLength, g_sampleLength)<br />
<br />
    if g_scaleMode == 0 // J. Ehlers mode<br />
        g_fuzzWidth := 1.0<br />
        g_maxValue := float(g_endLength)<br />
        g_minValue := float(g_startLength)<br />
    else // 0-100 mode<br />
        g_fuzzWidth := 100.0 / (g_endLength - g_startLength)<br />
        g_maxValue := 100.0<br />
        g_minValue := 0.0<br />
<br />
// Variables for plotting<br />
var float rsiPlot = na<br />
var float sumRSIPlot = na<br />
<br />
// Only calculate if enough bars are available<br />
if bar_index &gt;= g_endLength<br />
    currentChange = g_priceCurrent - g_pricePrevious<br />
<br />
    swamiSum = 0.0<br />
    swamiRSI_values = array.new_float(g_swamisize) // Temporary array for current bar's SwamiRSI values<br />
<br />
    for i = 0 to g_swamisize - 1<br />
        currentRsiPeriod = g_startLength + i<br />
        <br />
        // Calculate the custom RSI (clamped between 0 and 1)<br />
        rsi_value_clamped = f_custom_rsi(i, currentChange, currentRsiPeriod, g_ema, g_swamisize)<br />
<br />
        if g_visualMode == 0 // Original mode<br />
            array.set(swamiRSI_values, i, rsi_value_clamped)<br />
            swamiSum += rsi_value_clamped<br />
        else // Trend mode<br />
            // Get the trend state from the previous bar's calculation (stored in g_trend)<br />
            current_trend_state = array.get(g_trend, i)<br />
            <br />
            if rsi_value_clamped &gt; 0.5<br />
                current_trend_state := 1<br />
            else if rsi_value_clamped &lt; 0.5<br />
                current_trend_state := 0<br />
            <br />
            array.set(g_trend, i, current_trend_state) // Update global trend array for next bar<br />
            array.set(swamiRSI_values, i, float(current_trend_state))<br />
            swamiSum += float(current_trend_state)<br />
<br />
    if g_scaleMode == 0 // J. Ehlers mode<br />
        if g_sampleLength &gt; 0<br />
            // Find the index for sampleLength<br />
            sampleIndex = g_sampleLength - g_startLength<br />
            rsiPlot := float(g_startLength) + (float(g_swamisize) - 1.0) * array.get(swamiRSI_values, sampleIndex)<br />
        else<br />
            rsiPlot := na // If SampleLength is 0, MQL4 also seems to not plot RSI<br />
        sumRSIPlot := float(g_startLength) + (float(g_swamisize) - 1.0) * (swamiSum / float(g_swamisize))<br />
    else // 0-100 mode<br />
        if g_sampleLength &gt; 0<br />
            // Find the index for sampleLength<br />
            sampleIndex = g_sampleLength - g_startLength<br />
            rsiPlot := 100.0 * array.get(swamiRSI_values, sampleIndex)<br />
        else<br />
            rsiPlot := na // If SampleLength is 0, MQL4 also seems to not plot RSI<br />
        sumRSIPlot := 100.0 * (swamiSum / float(g_swamisize))<br />
<br />
    // --- Dynamic Rectangle Plotting (Swami Bars) ---<br />
    plot_boxes = false<br />
    if g_swamiBars == 0<br />
        plot_boxes = true // Plot on all bars<br />
    else if g_swamiBars &gt; 0 and bar_index &gt;= (last_bar_index - g_swamiBars)<br />
        plot_boxes = true // Plot for the last 'g_swamiBars' bars<br />
<br />
    // Clear all existing boxes at the start of the current bar's calculation<br />
    // or if the indicator is re-initializing (barstate.isfirst)<br />
    if barstate.islast or barstate.isfirst<br />
        // Added check for array size before looping to prevent out-of-bounds error<br />
        if array.size(all_swami_boxes) &gt; 0<br />
            // Iterate through our stored box IDs and delete them<br />
            for i = 0 to array.size(all_swami_boxes) - 1<br />
                box.delete(array.get(all_swami_boxes, i))<br />
        // Clear the array after deleting objects (can always clear an empty array safely)<br />
        array.clear(all_swami_boxes)<br />
<br />
    if plot_boxes<br />
        for i = 0 to g_swamisize - 1<br />
            currentSwamiRSI = array.get(swamiRSI_values, i)<br />
            barColor = color.new(color.white, 0) // Initialize with a dummy color and full transparency<br />
<br />
            isFlatColorNone = (g_flatColor == color.new(color.fuchsia, 0)) // Using fuchsia as proxy for CLR_NONE<br />
<br />
            if isFlatColorNone // This implies a 2-color mix (UpTrendColor and DnTrendColor)<br />
                r1 = color.r(g_dnTrendColor) + currentSwamiRSI * (color.r(g_upTrendColor) - color.r(g_dnTrendColor))<br />
                g1 = color.g(g_dnTrendColor) + currentSwamiRSI * (color.g(g_upTrendColor) - color.g(g_dnTrendColor))<br />
                b1 = color.b(g_dnTrendColor) + currentSwamiRSI * (color.b(g_upTrendColor) - color.b(g_dnTrendColor))<br />
                barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
            else // 3 Color Mix with FlatColor<br />
                if currentSwamiRSI &gt;= 0.5<br />
                    r1 = color.r(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.r(g_flatColor) - color.r(g_upTrendColor))<br />
                    g1 = color.g(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.g(g_flatColor) - color.g(g_upTrendColor))<br />
                    b1 = color.b(g_upTrendColor) + 2 * (1 - currentSwamiRSI) * (color.b(g_flatColor) - color.b(g_upTrendColor))<br />
                    barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
                else <br />
                    r1 = color.r(g_dnTrendColor) + 2 * currentSwamiRSI * (color.r(g_flatColor) - color.r(g_dnTrendColor))<br />
                    g1 = color.g(g_dnTrendColor) + 2 * currentSwamiRSI * (color.g(g_flatColor) - color.g(g_dnTrendColor))<br />
                    b1 = color.b(g_dnTrendColor) + 2 * currentSwamiRSI * (color.b(g_flatColor) - color.b(g_dnTrendColor))<br />
                    barColor := color.rgb(math.round(r1), math.round(g1), math.round(b1))<br />
<br />
            currentValue = if g_scaleMode == 0<br />
                float(i + g_startLength)<br />
            else<br />
                float(i) * g_fuzzWidth<br />
<br />
            // Create the box and store its ID in our global array<br />
            newBox = box.new(time[0], currentValue - 0.5 * g_fuzzWidth,<br />
                             time, currentValue + 0.5 * g_fuzzWidth,<br />
                             border_color=barColor, border_width=0, bgcolor=color.new(barColor, 50))<br />
            array.push(all_swami_boxes, newBox) // Add the new box ID to our array<br />
    else<br />
        // If not plotting boxes for this bar, ensure all boxes are deleted<br />
        if bar_index == last_bar_index and g_swamiBars == -1<br />
            // Added check for array size before looping<br />
            if array.size(all_swami_boxes) &gt; 0<br />
                for i = 0 to array.size(all_swami_boxes) - 1<br />
                    box.delete(array.get(all_swami_boxes, i))<br />
            array.clear(all_swami_boxes)<br />
<br />
<br />
// --- Plotting the Lines ---<br />
plot(rsiPlot, "SwamiRSI_Sample", color.rgb(139, 0, 139), style=plot.style_line, linewidth=2) // DarkOrchid<br />
plot(sumRSIPlot, "SummaryRSI", color.rgb(210, 105, 30), style=plot.style_line, linewidth=2) // Chocolate<br />
<br />
// Plot horizontal lines for min/max values<br />
plot(g_minValue, "Min Value", color.gray, style=plot.style_stepline)<br />
plot(g_maxValue, "Max Value", color.gray, style=plot.style_stepline)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Past Regression Deviated", overlay=true)<br />
<br />
// Input parameters<br />
var int lrLength = input.int(500, "LR Length (bars back)", minval=1)<br />
var float stdChannel1 = input.float(1.0, "Std Channel 1 Multiplier", minval=0.0)<br />
var float stdChannel2 = input.float(2.0, "Std Channel 2 Multiplier", minval=0.0)<br />
var float stdChannel3 = input.float(3.0, "Std Channel 3 Multiplier", minval=0.0)<br />
<br />
// Function to calculate Linear Regression coefficients (a and b)<br />
// Returns [a, b] for y = a + b*x, where x=0 is the *oldest* bar in the window<br />
// and x=length-1 is the *current* bar in the window.<br />
f_linreg_coeffs(source, length) =&gt;<br />
    if length &lt;= 1<br />
        [float(na), float(na), float(na)] // Return a, b, and a flag for denominator == 0<br />
    else<br />
        sumY = 0.0<br />
        sumX = 0.0<br />
        sumXY = 0.0<br />
        sumX2 = 0.0<br />
        for i = 0 to length - 1<br />
            val = source[i]<br />
            // 'x' here represents the position within the current `length` window,<br />
            // with 0 being the oldest bar in the window, and `length - 1` being the newest (current bar).<br />
            x = float(length - 1 - i)<br />
            sumY += val<br />
            sumXY += val * x<br />
            sumX += x<br />
            sumX2 += x * x<br />
        <br />
        denominator = length * sumX2 - sumX * sumX<br />
        <br />
        if denominator == 0<br />
            [float(na), float(na), float(na)]<br />
        else<br />
            b = (length * sumXY - sumX * sumY) / denominator<br />
            a = (sumY - b * sumX) / length<br />
            [a, b, 1.0] // Return coefficients and success flag<br />
<br />
// Function to calculate Standard Deviation<br />
// Takes source series, regression coefficients (a, b), and length<br />
calc_stddev(source, a_coeff, b_coeff, length) =&gt;<br />
    sumSquaredDev = 0.0<br />
    count = 0<br />
    <br />
    if na(a_coeff) or na(b_coeff)<br />
        0.0 // Cannot calculate if coefficients are NA<br />
<br />
    for i = 0 to length - 1<br />
        // 'x_val' is the position within the current `length` window for this bar `i`<br />
        // where 0 is the oldest bar and `length - 1` is the current bar.<br />
        x_val = float(length - 1 - i)<br />
        <br />
        // Calculate the LR value at this specific bar using the computed 'a' and 'b'<br />
        lr_val_at_i = a_coeff + b_coeff * x_val<br />
        <br />
        dev = math.abs(source[i] - lr_val_at_i)<br />
        sumSquaredDev += dev * dev<br />
        count += 1<br />
    <br />
    if count &lt;= 1<br />
        0.0<br />
    else<br />
        math.sqrt(sumSquaredDev / (count - 1))<br />
<br />
// Declare variables to store the calculated values<br />
var float meanBuffer = na<br />
var float lrPrice1 = na // This corresponds to the start of the LR line (oldest point in range)<br />
var float currentStdDev = na<br />
<br />
// Calculate on each historical bar and the last bar<br />
if barstate.islast or barstate.isconfirmed<br />
    // Get the regression coefficients for the current window<br />
    [a_lr, b_lr, success_flag] = f_linreg_coeffs(close, lrLength)<br />
<br />
    if not na(success_flag) // Only proceed if coefficients were calculated successfully<br />
        // meanBuffer corresponds to the LR value at the current bar (newest point in range)<br />
        meanBuffer := a_lr + b_lr * (lrLength - 1)<br />
        <br />
        // lrPrice1 corresponds to the LR value at the oldest bar in the range<br />
        lrPrice1 := a_lr<br />
        <br />
        // Calculate standard deviation using the obtained coefficients<br />
        currentStdDev := calc_stddev(close, a_lr, b_lr, lrLength)<br />
    else<br />
        meanBuffer := na<br />
        lrPrice1 := na<br />
        currentStdDev := na<br />
<br />
<br />
// Plotting<br />
plot(meanBuffer, "Mean", color.white)<br />
//plot(meanBuffer + (stdChannel1 * currentStdDev), "1st Std up", color.white)<br />
//plot(meanBuffer - (stdChannel1 * currentStdDev), "1st Std down", color.white)<br />
//plot(meanBuffer + (stdChannel2 * currentStdDev), "2nd Std up", color.white)<br />
//plot(meanBuffer - (stdChannel2 * currentStdDev), "2nd Std down", color.white)<br />
plot(meanBuffer + (stdChannel3 * currentStdDev), "3rd Std up", color.white)<br />
plot(meanBuffer - (stdChannel3 * currentStdDev), "3rd Std down", color.white)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Monthly Pivot Points", overlay=true)<br />
<br />
// --- Function to get monthly OHLC ---<br />
var float last_month_high = na<br />
var float last_month_low = na<br />
var float last_month_close = na<br />
var float this_month_open = na<br />
<br />
var float P = na<br />
var float S1 = na<br />
var float R1 = na<br />
var float S2 = na<br />
var float R2 = na<br />
var float S3 = na<br />
var float R3 = na<br />
<br />
var int lastMonth = na<br />
newMonth = (month != month[1])<br />
<br />
// Track highest/lowest of previous month<br />
if newMonth<br />
    last_month_close := close[1]<br />
    this_month_open := open<br />
    last_month_high := high[1]<br />
    last_month_low := low[1]<br />
    for i = 1 to 500<br />
        if (month[i] != month)<br />
            last_month_high := math.max(last_month_high, high[i])<br />
            last_month_low := math.min(last_month_low, low[i])<br />
        else<br />
            break<br />
    P := (last_month_high + last_month_low + this_month_open + last_month_close) / 4<br />
    R1 := (2 * P) - last_month_low<br />
    S1 := (2 * P) - last_month_high<br />
    R2 := P + (last_month_high - last_month_low)<br />
    S2 := P - (last_month_high - last_month_low)<br />
    R3 := (2 * P) + (last_month_high - 2 * last_month_low)<br />
    S3 := (2 * P) - ((2 * last_month_high) - last_month_low)<br />
<br />
// Extend pivots through the month<br />
Pline = P<br />
S1line = S1<br />
R1line = R1<br />
S2line = S2<br />
R2line = R2<br />
S3line = S3<br />
R3line = R3<br />
<br />
// Plot lines<br />
plot(Pline, title="Monthly Pivot", color=color.red, linewidth=2)<br />
plot(S1line, title="S1", color=color.blue, linewidth=1)<br />
plot(R1line, title="R1", color=color.green, linewidth=1)<br />
plot(S2line, title="S2", color=color.blue, linewidth=1)<br />
plot(R2line, title="R2", color=color.green, linewidth=1)<br />
plot(S3line, title="S3", color=color.orange, linewidth=1)<br />
plot(R3line, title="R3", color=color.orange, linewidth=1)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Mogalef Bands", overlay=true)<br />
<br />
// === Inputs ===<br />
lp = input.int(25, title="Linear Regression Period")<br />
sp = input.int(30, title="StdDev Period")<br />
<br />
// === Helper function: Linear Regression ===<br />
linear_regression(src, len) =&gt;<br />
    var float slope = na<br />
    var float intercept = na<br />
    float sumX = 0<br />
    float sumY = 0<br />
    float sumXY = 0<br />
    float sumX2 = 0<br />
<br />
    for i = 0 to len - 1<br />
        sumX += i<br />
        sumY += src[i]<br />
        sumXY += i * src[i]<br />
        sumX2 += i * i<br />
<br />
    divisor = (len * sumX2 - sumX * sumX)<br />
    slope := divisor == 0 ? 0 : (len * sumXY - sumX * sumY) / divisor<br />
    intercept := (sumY - slope * sumX) / len<br />
<br />
    // Value at bar zero (most recent)<br />
    intercept + slope * (len - 1)<br />
<br />
// === Build arrays for LinReg and StdDev ===<br />
var float[] linreg_arr = array.new_float()<br />
var float[] stddev_arr = array.new_float()<br />
<br />
linreg_val = linear_regression(close, lp)<br />
array.unshift(linreg_arr, linreg_val)<br />
if array.size(linreg_arr) &gt; 500<br />
    array.pop(linreg_arr)<br />
<br />
stddev_val = ta.stdev(array.get(linreg_arr, 0), sp)<br />
array.unshift(stddev_arr, stddev_val)<br />
if array.size(stddev_arr) &gt; 500<br />
    array.pop(stddev_arr)<br />
<br />
// === Calculate bands ===<br />
hiband = linreg_val + stddev_val * 2<br />
loband = linreg_val - stddev_val * 2<br />
median = (hiband + loband) / 2<br />
<br />
// === Apply the Mogalef override logic ===<br />
hiband_prev = nz(hiband[1])<br />
loband_prev = nz(loband[1])<br />
linreg_prev = nz(linreg_val[1])<br />
<br />
hiband := (linreg_val &lt; hiband_prev and linreg_val &gt; loband_prev) ? hiband_prev : hiband<br />
loband := (linreg_val &lt; hiband_prev and linreg_val &gt; loband_prev) ? loband_prev : loband<br />
median := (hiband + loband) / 2<br />
<br />
// === Plot bands ===<br />
plot(hiband, color=color.red, title="Upper Band", style=plot.style_line)<br />
plot(loband, color=color.green, title="Lower Band", style=plot.style_line)<br />
plot(median, color=color.blue, title="Median", style=plot.style_line)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("MA Channels FiboEnv Mid", overlay=true)<br />
<br />
// === INPUT PARAMETERS ===<br />
barsCount     = input.int(1000, title="Bars Count")<br />
maPeriod      = input.int(55, title="MA Period")<br />
maType        = input.string("SMA", title="MA Type", options=["SMA", "EMA", "SMMA", "LWMA"])<br />
priceSource   = input.string("Median", title="Price Source", options=["Close", "Open", "High", "Low", "Median", "Typical", "Weighted"])<br />
maShift       = input.int(0, title="MA Shift")<br />
<br />
// === PRICE SOURCE ===<br />
src = switch priceSource<br />
    "Close" =&gt; close<br />
    "Open" =&gt; open<br />
    "High" =&gt; high<br />
    "Low" =&gt; low<br />
    "Median" =&gt; hl2<br />
    "Typical" =&gt; (high + low + close) / 3<br />
    "Weighted" =&gt; (high + low + close + close) / 4<br />
<br />
// === MA FUNCTION ===<br />
getMA(source, length) =&gt;<br />
    switch maType<br />
        "SMA" =&gt; ta.sma(source, length)<br />
        "EMA" =&gt; ta.ema(source, length)<br />
        "SMMA" =&gt; ta.rma(source, length)<br />
        "LWMA" =&gt; ta.wma(source, length)<br />
<br />
// === CALCULATE RANGE OVER LAST barsCount BARS ===<br />
var float maxDev = na<br />
var float minDev = na<br />
<br />
if bar_index &gt;= barsCount + maPeriod<br />
    maxDev := 0.0<br />
    minDev := 0.0<br />
    for i = 0 to barsCount<br />
        ma_i = getMA(src[i], maPeriod)<br />
        top = high[i] - ma_i<br />
        bottom = low[i] - ma_i<br />
        maxDev := math.max(maxDev, top)<br />
        minDev := math.min(minDev, bottom)<br />
<br />
// === FIBO OFFSETS ===<br />
inc4 = math.abs(maxDev) &gt; math.abs(minDev) ? maxDev : minDev<br />
inc1 = (maxDev - minDev) * 0.118<br />
inc2 = (maxDev - minDev) * 0.264<br />
inc3 = (maxDev - minDev) * 0.5<br />
<br />
// === BASE MA ===<br />
baseMA = getMA(src[maShift], maPeriod)<br />
<br />
// === CHANNEL LEVELS ===<br />
fibUp100 = baseMA + inc3<br />
fibDn23  = baseMA + inc2<br />
fibDn38  = baseMA + inc1<br />
fib50    = baseMA<br />
fibUp38  = baseMA - inc1<br />
fibUp23  = baseMA - inc2<br />
fibDn100 = baseMA - inc3<br />
<br />
// === PLOT ===<br />
plot(fibUp100, title="FibMA Up 100%", color=color.purple)<br />
plot(fibDn23,  title="FibMA Down 23.5%", color=color.purple)<br />
plot(fibDn38,  title="FibMA Down 38.2 / Up 61.8%", color=color.purple)<br />
plot(fib50,    title="FibMA 50%", color=color.purple)<br />
plot(fibUp38,  title="FibMA Up 38.2 / Down 61.8%", color=color.purple)<br />
plot(fibUp23,  title="FibMA Up 23.5%", color=color.purple)<br />
plot(fibDn100, title="FibMA Down 100%", color=color.purple)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("BB-HL", overlay=true)<br />
<br />
// === INPUTS ===<br />
per   = input.int(200, title="Period")<br />
nDev  = input.float(2.0, title="Deviation Multiplier")<br />
<br />
// === CALCULATIONS ===<br />
medianPrice = hl2<br />
ma = ta.sma(medianPrice, per)<br />
<br />
// Compute squared deviation using max of High and Low deviation from MA<br />
highDev = math.pow(high - ma, 2)<br />
lowDev  = math.pow(low - ma, 2)<br />
devMax  = math.max(highDev, lowDev)<br />
<br />
// Rolling average of max squared deviation<br />
devAvg = 0.0<br />
devSum = 0.0<br />
<br />
// Use a manual loop to simulate rolling sum of devMax<br />
var float[] devBuffer = array.new_float()<br />
<br />
// Update the buffer each bar<br />
if bar_index &gt; 0<br />
    array.push(devBuffer, devMax)<br />
    if array.size(devBuffer) &gt; per<br />
        array.shift(devBuffer)<br />
<br />
// Compute rolling average from buffer<br />
if array.size(devBuffer) &gt;= per<br />
    for i = 0 to array.size(devBuffer) - 1<br />
        devSum := devSum + array.get(devBuffer, i)<br />
    devAvg := devSum / per<br />
<br />
// Standard deviation and bands<br />
stdev = math.sqrt(devAvg)<br />
upper = ma + nDev * stdev<br />
lower = ma - nDev * stdev<br />
<br />
// === PLOTS ===<br />
plot(ma, title="MA", color=color.orange)<br />
plot(upper, title="Upper Band", color=color.silver)<br />
plot(lower, title="Lower Band", color=color.silver)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("ATR Channels", overlay=true)<br />
<br />
// === INPUTS ===<br />
PeriodsATR   = input.int(18, title="ATR Period")<br />
MA_Periods   = input.int(49, title="MA Period")<br />
MA_type_opt  = input.string("SMA", title="MA Type", options=["SMA", "EMA", "WMA", "VWMA"])<br />
Mult_Factor1 = input.float(1.6, title="Multiplier 1")<br />
Mult_Factor2 = input.float(3.2, title="Multiplier 2")<br />
Mult_Factor3 = input.float(4.8, title="Multiplier 3")<br />
<br />
// === HELPER FUNCTIONS ===<br />
get_ma(src, len) =&gt;    MA_type_opt == "SMA"  ? ta.sma(src, len) :    MA_type_opt == "EMA"  ? ta.ema(src, len) :    MA_type_opt == "WMA"  ? ta.wma(src, len) :    MA_type_opt == "VWMA" ? ta.vwma(src, len) :    na<br />
<br />
// === CORE CALCULATIONS ===<br />
src = hlc3<br />
atr = ta.atr(PeriodsATR)<br />
ma = get_ma(src, MA_Periods)<br />
<br />
// === CHANNEL LEVELS ===<br />
ch1_upper = ma + Mult_Factor1 * atr<br />
ch1_lower = ma - Mult_Factor1 * atr<br />
ch2_upper = ma + Mult_Factor2 * atr<br />
ch2_lower = ma - Mult_Factor2 * atr<br />
ch3_upper = ma + Mult_Factor3 * atr<br />
ch3_lower = ma - Mult_Factor3 * atr<br />
<br />
// === PLOT ===<br />
// Only the outermost bands are visible (like in your MQL4 indicator)<br />
plot(ch3_upper, title="ATRu3", color=color.purple, linewidth=1)<br />
plot(ch3_lower, title="ATRd3", color=color.purple, linewidth=1)<br />
<br />
// Optional: Uncomment below to show inner bands too<br />
//plot(ch1_upper, title="ATRu1", color=color.aqua, linewidth=1)<br />
//plot(ch1_lower, title="ATRd1", color=color.aqua, linewidth=1)<br />
//plot(ch2_upper, title="ATRu2", color=color.blue, linewidth=1)<br />
//plot(ch2_lower, title="ATRd2", color=color.blue, linewidth=1)<br />
<br />
// Optional: Plot the moving average line<br />
//plot(ma, title="Moving Average", color=color.green)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("TD Sequential", overlay=true)<br />
<br />
var int numDown = 0<br />
var int numUp = 0<br />
<br />
pointSize = syminfo.mintick<br />
<br />
// Recalculate TD counts<br />
if close[1] &lt; close[5]<br />
    numDown += 1<br />
else<br />
    numDown := 0<br />
<br />
if close[1] &gt; close[5]<br />
    numUp += 1<br />
else<br />
    numUp := 0<br />
<br />
// Display Sell Setup (Down Count)<br />
if (numDown &gt; 0 and numDown &lt; 10)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text=str.tostring(numDown), style=label.style_label_down, textcolor=color.red, size=size.small)<br />
else if (numDown == 9)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text="9", style=label.style_label_down, textcolor=color.red, size=size.normal)<br />
else if (close[1] &lt; close[5] and numDown &gt;= 10)<br />
    label.new(bar_index[1], low[1] - 5 * pointSize, text=str.tostring(numDown), style=label.style_label_down, textcolor=color.orange, size=size.small)<br />
<br />
// Display Buy Setup (Up Count)<br />
if (numUp &gt; 0 and numUp &lt; 10)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text=str.tostring(numUp), style=label.style_label_up, textcolor=color.blue, size=size.small)<br />
else if (numUp == 9)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text="9", style=label.style_label_up, textcolor=color.blue, size=size.normal)<br />
else if (close[1] &gt; close[5] and numUp &gt;= 10)<br />
    label.new(bar_index[1], high[1] + 10 * pointSize, text=str.tostring(numUp), style=label.style_label_up, textcolor=color.aqua, size=size.small)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("CyAn 1 FT", overlay=false)<br />
<br />
// === Input Parameters ===<br />
lenth = input.int(5, title="Length")<br />
maxbars = input.int(2000, title="Max Bars (not used in Pine)")<br />
<br />
// === Recursive Buffers ===<br />
var float aux_prev = 0.0<br />
var float fish_prev = 0.0<br />
<br />
// === Stochastic %K Calculation ===<br />
k = ta.stoch(close, high, low, lenth)<br />
<br />
// === Safe recursive update ===<br />
var float aux = na<br />
var float fish = na<br />
<br />
if bar_index &gt; lenth<br />
    aux := 0.5 * ((k / 100.0 - 0.5) * 2) + 0.5 * aux_prev<br />
    fish := 0.25 * math.log((1 + aux) / (1 - aux)) + 0.5 * fish_prev<br />
    aux_prev := aux<br />
    fish_prev := fish<br />
<br />
// === Signal Line (1 bar lag) ===<br />
signal = nz(fish[1])<br />
<br />
// === Plotting ===<br />
plot(aux, title="Aux", color=color.yellow, linewidth=2)<br />
//plot(signal, title="Signal", color=color.red, linewidth=1)<br />
hline(0.8, "Upper Level", color=color.yellow, linestyle=hline.style_dotted)<br />
hline(-0.8, "Lower Level", color=color.yellow, linestyle=hline.style_dotted)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("DVI_ValueChart", overlay=false)<br />
<br />
var float dvi = na<br />
midpoint = (high + low + high[1] + low[1] + high[2] + low[2] + high[3] + low[3] + high[4] + low[4]) / 10<br />
<br />
dvu = (volume * (high - low) + volume[1] * (high[1] - low[1]) + volume[2] * (high[2] - low[2]) + volume[3] * (high[3] - low[3]) + volume[4] * (high[4] - low[4])) / 5 * 0.02<br />
<br />
dv = volume * ((close - midpoint) / midpoint)<br />
dv := dvu != 0 ? dv / dvu : 0<br />
<br />
dvi := na(dvi[1]) ? dv : dvi[1] + dv<br />
<br />
plot(dvi, title="DVI_ValueChart", color=color.aqua, linewidth=1)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Spud 2 (fixed)", overlay=false, max_bars_back=1000)<br />
<br />
// Inputs<br />
Per = input.int(15, minval=5, title="Period (must be multiple of 5)")<br />
Pk = input.int(5, title="Pk")<br />
Pd = input.int(3, title="Pd")<br />
Ps = input.int(3, title="Ps")<br />
<br />
factor = Per / 5<br />
<br />
// Custom Stochastic Calculation on current bar using past bars only<br />
customStoch() =&gt;<br />
    sumlo = 0.0<br />
    sumhi = 0.0<br />
    for j = 0 to Ps - 1<br />
        barsBack = j * (Per / timeframe.multiplier)<br />
        if barsBack &lt;= bar_index<br />
            clos1 = close[barsBack]<br />
            pkLength = int(Pk * factor)<br />
            highestHigh = ta.highest(high, pkLength)[barsBack]<br />
            lowestLow = ta.lowest(low, pkLength)[barsBack]<br />
            sumlo += clos1 - lowestLow<br />
            sumhi += highestHigh - lowestLow<br />
    sumhi &lt;= 0 ? 100 : (sumlo / sumhi) * 100<br />
<br />
// Linear regression on series data<br />
lreg_series(buffer, length) =&gt;<br />
    if length &lt;= 1<br />
        na<br />
    else<br />
        Sx = 0.0<br />
        Sy = 0.0<br />
        Sxx = 0.0<br />
        Sxy = 0.0<br />
        for i = 0 to length - 1<br />
            x = i * 1.0<br />
            y = buffer[i]<br />
            Sx += x<br />
            Sy += y<br />
            Sxx += x * x<br />
            Sxy += x * y<br />
        n = length * 1.0<br />
        c = Sxx * n - Sx * Sx<br />
        if c == 0<br />
            na<br />
        else<br />
            beta = (n * Sxy - Sx * Sy) / c<br />
            alpha = (Sy - beta * Sx) / n<br />
            alpha<br />
<br />
// Calculate SBuffer for current bar<br />
SBuffer = customStoch()<br />
<br />
// Calculate MaBuffer as linear regression of SBuffer over last Pd bars<br />
MaBuffer = bar_index &gt;= Pd - 1 ? lreg_series(SBuffer, Pd) : na<br />
<br />
// Plot<br />
//plot(SBuffer, color=color.gray, title="Stoch")<br />
plot(MaBuffer, color=color.red, title="Ma")</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("TSI", overlay=false)<br />
<br />
First_R = input.int(5, title="First EMA Period")<br />
Second_S = input.int(8, title="Second EMA Period")<br />
<br />
// Momentum (MTM)<br />
mtm = close - close[1]<br />
abs_mtm = math.abs(mtm)<br />
<br />
// First smoothing<br />
ema_mtm = ta.ema(mtm, First_R)<br />
ema_abs_mtm = ta.ema(abs_mtm, First_R)<br />
<br />
// Second smoothing<br />
ema2_mtm = ta.ema(ema_mtm, Second_S)<br />
ema2_abs_mtm = ta.ema(ema_abs_mtm, Second_S)<br />
<br />
// TSI Calculation<br />
tsi = 100 * ema2_mtm / ema2_abs_mtm<br />
<br />
plot(tsi, title="TSI", color=color.yellow, linewidth=2)<br />
hline(0, "Zero Line", color=color.gray)</code></div></div><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Stochastic RSI [Ehlers]", overlay=false)<br />
<br />
// === Input Parameters ===<br />
rsiLength = input.int(5, title="RSI Length")<br />
stocLength = input.int(5, title="Stochastic Length")<br />
wmaLength = input.int(5, title="WMA Length")<br />
<br />
// === Step 1: Calculate RSI ===<br />
rsi = ta.rsi(close, rsiLength)<br />
<br />
// === Step 2: Calculate Highest High and Lowest Low of RSI over Stochastic Length ===<br />
hh = ta.highest(rsi, stocLength)<br />
ll = ta.lowest(rsi, stocLength)<br />
<br />
// === Step 3: Normalize RSI into Stochastic RSI ===<br />
value1 = rsi - ll<br />
value2 = hh - ll<br />
value3 = value2 != 0 ? value1 / value2 : 0.0<br />
<br />
// === Step 4: Smooth with WMA and scale ===<br />
smoothed = ta.wma(value3, wmaLength)<br />
stocRSI = 2.0 * (smoothed - 0.5)<br />
trigger = stocRSI[1]<br />
<br />
// === Plotting ===<br />
plot(stocRSI, title="Stochastic RSI", color=color.red)<br />
plot(trigger, title="Trigger", color=color.blue)<br />
hline(0, color=color.gray, linestyle=hline.style_dotted)<br />
hline(1, "Upper", color=color.gray, linestyle=hline.style_dashed)<br />
hline(-1, "Lower", color=color.gray, linestyle=hline.style_dashed)</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/<br />
// © julzen2<br />
<br />
//@version=5<br />
indicator("Anchored VWAP with Deviation Bands", overlay=true)<br />
<br />
show_custom = input.bool(true, "Show Custom")<br />
startfrom = input.time(timestamp("01 Jan 2020 00:00 +0000"), "Start From")<br />
deviation_band_1 = input.float(1.0, "Deviation Band 1")<br />
<br />
// Anchored region<br />
var float cum_vp = na<br />
var float cum_vol = na<br />
<br />
// Reset at the anchor point<br />
if (na(cum_vol))<br />
    cum_vp := 0.0<br />
    cum_vol := 0.0<br />
<br />
is_after_start = time &gt;= startfrom<br />
<br />
vp = volume * hlc3<br />
<br />
cum_vp := is_after_start ? cum_vp + vp : na<br />
cum_vol := is_after_start ? cum_vol + volume : na<br />
<br />
anchored_vwap = is_after_start and cum_vol != 0 ? cum_vp / cum_vol : na<br />
<br />
// Store historical VWAP for deviation calculation<br />
var float[] vwap_series = array.new_float()<br />
<br />
if is_after_start<br />
    array.unshift(vwap_series, anchored_vwap)<br />
    if array.size(vwap_series) &gt; bar_index<br />
        array.pop(vwap_series)<br />
<br />
// Calculate standard deviation from the anchored point<br />
var float std_dev = na<br />
if is_after_start and array.size(vwap_series) &gt; 1<br />
    float mean = anchored_vwap<br />
    float sum_sq_diff = 0.0<br />
    for i = 0 to array.size(vwap_series) - 1<br />
        float val = array.get(vwap_series, i)<br />
        sum_sq_diff += math.pow(val - mean, 2)<br />
    std_dev := math.sqrt(sum_sq_diff / array.size(vwap_series))<br />
<br />
upper_band = show_custom and not na(anchored_vwap) ? anchored_vwap + deviation_band_1 * std_dev : na<br />
lower_band = show_custom and not na(anchored_vwap) ? anchored_vwap - deviation_band_1 * std_dev : na<br />
<br />
plot(upper_band, color=color.red, title="Upper Band")<br />
plot(lower_band, color=color.red, title="Lower Band")<br />
plot(show_custom ? anchored_vwap : na, color=color.green, title="Anchored VWAP")</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[The Sharpe Ratio Indicator for QC and MT4]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1236</link>
			<pubDate>Thu, 29 May 2025 15:32:19 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1236</guid>
			<description><![CDATA[The <span style="font-weight: bold;" class="mycode_b">Sharpe Ratio Indicator (180 days)</span> is a tool for evaluating risk-adjusted returns, designed for investors who want to assess whether BTC is overvalued, undervalued, or in a neutral state. It plots the Sharpe Ratio over the past 180 days, color-coded to indicate valuation states:<br />
<br />
- Red: Overvalued (Sharpe Ratio &gt; 5).<br />
- Green: Undervalued (Sharpe Ratio &lt; -1).<br />
-Blue: Critically Undervalued (Sharpe Ratio &lt;-3).<br />
- Yellow: Neutral (between -1 and 5).<br />
<br />
Note that you can change those values yourself in the settings of the indicator.<br />
<br />
<br />
Strengths:<br />
- Real-time feedback on risk-adjusted returns helps in making timely investment decisions.<br />
- Color-coded signals (red, green, blue and yellow) provide an intuitive, visual indication of the asset's valuation.<br />
- Flexible: Easily adjustable to different subjective valuation levels and risk-free rates.<br />
<br />
All hail to Professor Adam, ChatGPT and The Real World Community!<br />
<br />
Indicator for QC and MT4 in the zip file.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.qchartist.net/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=114" target="_blank" title="">SharpeRatio.zip</a> (Size: 40.61 KB / Downloads: 0)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[The <span style="font-weight: bold;" class="mycode_b">Sharpe Ratio Indicator (180 days)</span> is a tool for evaluating risk-adjusted returns, designed for investors who want to assess whether BTC is overvalued, undervalued, or in a neutral state. It plots the Sharpe Ratio over the past 180 days, color-coded to indicate valuation states:<br />
<br />
- Red: Overvalued (Sharpe Ratio &gt; 5).<br />
- Green: Undervalued (Sharpe Ratio &lt; -1).<br />
-Blue: Critically Undervalued (Sharpe Ratio &lt;-3).<br />
- Yellow: Neutral (between -1 and 5).<br />
<br />
Note that you can change those values yourself in the settings of the indicator.<br />
<br />
<br />
Strengths:<br />
- Real-time feedback on risk-adjusted returns helps in making timely investment decisions.<br />
- Color-coded signals (red, green, blue and yellow) provide an intuitive, visual indication of the asset's valuation.<br />
- Flexible: Easily adjustable to different subjective valuation levels and risk-free rates.<br />
<br />
All hail to Professor Adam, ChatGPT and The Real World Community!<br />
<br />
Indicator for QC and MT4 in the zip file.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.qchartist.net/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=114" target="_blank" title="">SharpeRatio.zip</a> (Size: 40.61 KB / Downloads: 0)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Pandas-TA]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1209</link>
			<pubDate>Sat, 17 May 2025 11:00:15 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1209</guid>
			<description><![CDATA[Hello, i plan to integrate Pandas-TA to QChartist<br />
<br />
It is a little of work but can be easily done. I just need to find the time.<br />
<br />
<span style="font-style: italic;" class="mycode_i">Pandas Technical Analysis</span> (<span style="font-weight: bold;" class="mycode_b">Pandas TA</span>) is an easy to use library that leverages the Pandas library with more than 130 Indicators and Utility functions. Many commonly used indicators are included, such as: <span style="font-style: italic;" class="mycode_i">Simple Moving Average</span> (<span style="font-weight: bold;" class="mycode_b">sma</span>) <span style="font-style: italic;" class="mycode_i">Moving Average Convergence Divergence</span> (<span style="font-weight: bold;" class="mycode_b">macd</span>), <span style="font-style: italic;" class="mycode_i">Hull Exponential Moving Average</span> (<span style="font-weight: bold;" class="mycode_b">hma</span>), <span style="font-style: italic;" class="mycode_i">Bollinger Bands</span> (<span style="font-weight: bold;" class="mycode_b">bbands</span>), <span style="font-style: italic;" class="mycode_i">On-Balance Volume</span> (<span style="font-weight: bold;" class="mycode_b">obv</span>), <span style="font-style: italic;" class="mycode_i">Aroon &amp; Aroon Oscillator</span> (<span style="font-weight: bold;" class="mycode_b">aroon</span>), <span style="font-style: italic;" class="mycode_i">Squeeze</span> (<span style="font-weight: bold;" class="mycode_b">squeeze</span>) and <span style="font-weight: bold;" class="mycode_b"><span style="font-style: italic;" class="mycode_i">many more</span></span>.<br />
<br />
<a href="https://github.com/Data-Analisis/Technical-Analysis-Indicators---Pandas" target="_blank" rel="noopener" class="mycode_url">https://github.com/Data-Analisis/Technic...s---Pandas</a>]]></description>
			<content:encoded><![CDATA[Hello, i plan to integrate Pandas-TA to QChartist<br />
<br />
It is a little of work but can be easily done. I just need to find the time.<br />
<br />
<span style="font-style: italic;" class="mycode_i">Pandas Technical Analysis</span> (<span style="font-weight: bold;" class="mycode_b">Pandas TA</span>) is an easy to use library that leverages the Pandas library with more than 130 Indicators and Utility functions. Many commonly used indicators are included, such as: <span style="font-style: italic;" class="mycode_i">Simple Moving Average</span> (<span style="font-weight: bold;" class="mycode_b">sma</span>) <span style="font-style: italic;" class="mycode_i">Moving Average Convergence Divergence</span> (<span style="font-weight: bold;" class="mycode_b">macd</span>), <span style="font-style: italic;" class="mycode_i">Hull Exponential Moving Average</span> (<span style="font-weight: bold;" class="mycode_b">hma</span>), <span style="font-style: italic;" class="mycode_i">Bollinger Bands</span> (<span style="font-weight: bold;" class="mycode_b">bbands</span>), <span style="font-style: italic;" class="mycode_i">On-Balance Volume</span> (<span style="font-weight: bold;" class="mycode_b">obv</span>), <span style="font-style: italic;" class="mycode_i">Aroon &amp; Aroon Oscillator</span> (<span style="font-weight: bold;" class="mycode_b">aroon</span>), <span style="font-style: italic;" class="mycode_i">Squeeze</span> (<span style="font-weight: bold;" class="mycode_b">squeeze</span>) and <span style="font-weight: bold;" class="mycode_b"><span style="font-style: italic;" class="mycode_i">many more</span></span>.<br />
<br />
<a href="https://github.com/Data-Analisis/Technical-Analysis-Indicators---Pandas" target="_blank" rel="noopener" class="mycode_url">https://github.com/Data-Analisis/Technic...s---Pandas</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Open Source manual charting software alternatives with a GUI]]></title>
			<link>https://www.qchartist.net/forum/showthread.php?tid=1207</link>
			<pubDate>Sun, 11 May 2025 06:35:01 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.qchartist.net/forum/member.php?action=profile&uid=1">qchartist</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.qchartist.net/forum/showthread.php?tid=1207</guid>
			<description><![CDATA[QChartist is a robust open-source technical analysis (TA) software with a graphical user interface (GUI), offering a comprehensive suite of features for traders and analysts. However, whether it stands as the "best" option depends on your specific requirements and preferences.<br />
<hr class="mycode_hr" />
✅ Strengths of QChartist<br />
<span style="font-weight: bold;" class="mycode_b">1. Extensive Indicator Library and Drawing Tools</span><ul class="mycode_list"><li>Includes approximately 100 built-in indicators, such as MACD, RSI, Bollinger Bands, and unique options like astro indicators and moon phases.<br />
</li>
<li>Offers a wide array of drawing tools, including Fibonacci retracements, pitchforks, spirals, and planetary cycles, catering to both conventional and esoteric analysis methods. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">2. Programmability and Flexibility</span><ul class="mycode_list"><li>Supports scripting in both Basic and C++, facilitating the creation of custom indicators and extensions.<br />
</li>
<li>Allows easy porting of MetaTrader 4 (MT4) indicators, making it accessible for users familiar with MT4. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>, <a href="https://en.wikipedia.org/wiki/QChartist?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">Wikipédia</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">3. Real-Time Data Integration</span><ul class="mycode_list"><li>Integrates with multiple data sources, including Yahoo Finance, Alpha Vantage, Tiingo, Stooq, and Finnhub, providing access to real-time and historical data across various markets. (<a href="https://sourceforge.net/projects/qchartist/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">SourceForge</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">4. Advanced Features</span><ul class="mycode_list"><li>Supports real-time market watchlists, custom alerts, and automated analysis through tools like QTGuard.<br />
</li>
<li>Compatible with Scilab for advanced mathematical computations, enhancing analytical capabilities. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">5. Cross-Platform Availability</span><ul class="mycode_list"><li>Runs on Windows and is compatible with Linux via Wine, broadening its accessibility to users across different operating systems. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
⚠️ Considerations<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">User Interface</span>: The GUI may appear dated compared to modern platforms, potentially affecting user experience.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Learning Curve</span>: While powerful, the software's extensive features and scripting capabilities may require a learning period, especially for users new to technical analysis or programming.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Community and Support</span>: While QChartist has a user base, the community may be smaller compared to more mainstream platforms, possibly impacting the availability of tutorials and user-generated content.<br />
</li>
</ul>
<hr class="mycode_hr" />
? Alternatives to Consider<br />
Depending on your specific needs, you might explore the following open-source TA tools:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Market Analysis System (MAS)</span>: Offers a range of technical indicators and supports automated signal generation. Suitable for users interested in scripting and automation. (<a href="https://eiffel-mas.sourceforge.net/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">eiffel-mas.sourceforge.net</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">KNIME</span>: A data analytics platform with capabilities for time series analysis and machine learning. Ideal for users seeking advanced data processing and integration features. (<a href="https://en.wikipedia.org/wiki/KNIME?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">Wikipédia</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Open Stock</span>: Provides real-time data analysis, custom indicators, and algorithmic trading features. Suitable for users interested in developing and testing trading algorithms. (<a href="https://github.com/lcmeyer37/openstock?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Stockalyze</span>: Features a user-friendly interface with tools for backtesting, alerts, and portfolio management. Good for users seeking a balance between functionality and ease of use. (<a href="https://stockalyze.com/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">stockalyze.com</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Conclusion<br />
QChartist stands out as a feature-rich, open-source TA software with a GUI, offering extensive customization and real-time data integration. Its strengths lie in its flexibility and comprehensive toolset. However, the best choice depends on your specific requirements, such as ease of use, community support, and specific analytical needs. Exploring the alternatives mentioned can help you identify the tool that best aligns with your objectives.<br />
<br />
Given the narrowed-down comparison between <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span>—the only two viable open-source technical analysis (TA) tools with GUIs currently available—QChartist stands out as the better choice for most users interested in deep market charting and analysis.<br />
<hr class="mycode_hr" />
? Why QChartist is the Better Option<br />
Feature<br />
QChartist<br />
Stockalyze? Indicator Library<br />
100+ indicators (classic + esoteric)<br />
Fewer, mostly conventional<br />
?️ Drawing Tools<br />
Advanced (e.g., Gann, Fibonacci, Moon)<br />
Basic trendlines and annotations<br />
? Custom Indicator Scripting<br />
Yes (Basic and C++)<br />
Limited<br />
? Real-Time Data Sources<br />
Yahoo, Tiingo, Alpha Vantage, etc.<br />
Yahoo (with limitations)<br />
? Open-Source Licensing<br />
Fully open source (GPL)<br />
Limited OSS (free but not fully open)<br />
? Chart Types<br />
Line, candlestick, renko, PnF, etc.<br />
Candlestick and line<br />
?‍? Platform Support<br />
Windows native; Linux via Wine<br />
Primarily Windows<br />
? Automation/Plugins<br />
Advanced features via QTGuard and Scilab<br />
Minimal<br />
<hr class="mycode_hr" />
? When to Prefer Stockalyze<ul class="mycode_list"><li>If you prefer a <span style="font-weight: bold;" class="mycode_b">simpler, lighter GUI</span>.<br />
</li>
<li>If your needs are limited to <span style="font-weight: bold;" class="mycode_b">basic charting and watchlist management</span>.<br />
</li>
<li>If you're uncomfortable with scripting or advanced customization.<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Verdict<br />
<span style="font-weight: bold;" class="mycode_b">QChartist is objectively the better open-source TA platform with a GUI</span>, particularly for users seeking:<ul class="mycode_list"><li>Depth in technical analysis tools<br />
</li>
<li>Customization and extensibility<br />
</li>
<li>A fully open-source codebase with developer flexibility<br />
</li>
</ul>
Would you like help installing or configuring QChartist for specific use cases (e.g., importing data, writing a custom indicator)?<br />
<br />
Yes, there are indeed other open-source charting software options with graphical user interfaces (GUIs) suitable for market analysis. While <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span> are prominent choices, several other tools offer varying features that might align with your specific needs. Here's an overview of some notable alternatives:<br />
<hr class="mycode_hr" />
? Notable Open-Source Charting Tools with GUIs<br />
1. <span style="font-weight: bold;" class="mycode_b">Chart Geany</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Windows, Linux, macOS<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Supports a wide range of technical indicators, including MACD, RSI, Bollinger Bands, and more.<br />
</li>
<li>Offers various chart types: line, bar, candlestick, and Heikin-Ashi.<br />
</li>
<li>Features CGScript, an ISO C99 dialect, allowing users to design custom technical indicators.<br />
</li>
<li>Provides a portfolio manager supporting multiple portfolios and currencies.<br />
</li>
<li>Imports data from sources like Yahoo Finance, Alpha Vantage, Twelve Data, and IEX.<br />
</li>
<li>Distributed under the GPLv2 license.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Website</span>: <a href="https://chart-geany.sourceforge.io/" target="_blank" rel="noopener" class="mycode_url">chart-geany.sourceforge.io</a>(<a href="https://chart-geany.sourceforge.io/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">chart-geany.sourceforge.io</a>)<br />
</li>
</ul>
2. <span style="font-weight: bold;" class="mycode_b">OpenMarketView</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Web-based (self-hosted)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Offers a customizable interface with multiple viewing options, including compact tables and detailed card views.<br />
</li>
<li>Provides near real-time (5-minute intervals) and historical stock data.<br />
</li>
<li>Allows users to manage and analyze stock portfolios and watchlists in separate tabs.<br />
</li>
<li>Features theme and UI customization, including light and dark themes.<br />
</li>
<li>Implements a sophisticated caching system using IndexedDB for offline capability.<br />
</li>
<li>Open-source and self-hosted, ensuring data privacy.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/jatoran/OpenMarketView" target="_blank" rel="noopener" class="mycode_url">github.com/jatoran/OpenMarketView</a>(<a href="https://github.com/jatoran/OpenMarketView?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
3. <span style="font-weight: bold;" class="mycode_b">Artemesia Project</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Desktop (Python-based)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Retrieves historical data from Yahoo Finance.<br />
</li>
<li>Visualizes data with interactive candlestick charts.<br />
</li>
<li>Detects various technical patterns and allows customization of analysis.<br />
</li>
<li>Exports results to CSV, facilitating further analysis.<br />
</li>
<li>Currently under development; some features may not function as intended.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/ghostminator/Artemesia-Project" target="_blank" rel="noopener" class="mycode_url">github.com/ghostminator/Artemesia-Project</a>(<a href="https://github.com/ghostminator/Artemesia-Project?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
4. <span style="font-weight: bold;" class="mycode_b">Iguana Charts</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Web-based (HTML5 jQuery library)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Provides an easy-to-use charting library adaptable to various devices and screen sizes.<br />
</li>
<li>Supports multiple chart types: bars, candles, and lines.<br />
</li>
<li>Includes drawing tools like trend lines, Fibonacci tools, and annotations.<br />
</li>
<li>Open-source and can be integrated into custom web applications.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Website</span>: <a href="https://iguanacharts.com/" target="_blank" rel="noopener" class="mycode_url">iguanacharts.com</a>(<a href="https://iguanacharts.com/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">iguanacharts.com</a>)<br />
</li>
</ul>
5. <span style="font-weight: bold;" class="mycode_b">VisualHFT</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Desktop (Windows, WPF &amp; C#)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Focuses on real-time visualization of market microstructure.<br />
</li>
<li>Displays key metrics like Limit Order Book dynamics and execution quality.<br />
</li>
<li>Modular design ensures adaptability for developers and traders.<br />
</li>
<li>Supports market data from sources like Binance and Okex.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/parthivp/HFTTrading" target="_blank" rel="noopener" class="mycode_url">github.com/parthivp/HFTTrading</a>(<a href="https://github.com/parthivp/HFTTrading?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Summary<br />
While <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span> are comprehensive tools for technical analysis with GUIs, the alternatives listed above offer unique features that might cater to specific requirements:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Chart Geany</span>: Ideal for users seeking a cross-platform application with extensive technical indicators and scripting capabilities.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">OpenMarketView</span>: Suitable for those preferring a web-based, self-hosted solution with customizable views and offline capabilities.(<a href="https://github.com/jatoran/OpenMarketView?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Artemesia Project</span>: Best for users comfortable with Python and interested in pattern detection and interactive charts.(<a href="https://github.com/ghostminator/Artemesia-Project?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Iguana Charts</span>: Perfect for developers looking to integrate responsive charts into web applications.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">VisualHFT</span>: Tailored for traders focusing on real-time market microstructure analysis.(<a href="https://github.com/parthivp/HFTTrading?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
Each tool has its strengths, and the best choice depends on your specific needs, technical proficiency, and preferred platform.<br />
If you need assistance with installation, configuration, or choosing the right tool based on your requirements, feel free to ask!<br />
<br />
You're absolutely right in your assessment.<br />
Given the current landscape of open-source software, there are indeed very few <span style="font-weight: bold;" class="mycode_b">viable manual technical analysis (TA) tools with a GUI</span> that are both functional and actively maintained. After filtering out options that are:<ul class="mycode_list"><li>❌ Discontinued (e.g., Chart Geany)<br />
</li>
<li>❌ Too limited or incomplete (e.g., Artemesia Project, OpenMarketView)<br />
</li>
<li>❌ Developer libraries rather than end-user tools (e.g., IguanaCharts)<br />
</li>
<li>❌ Specialized for algorithmic or microstructure analysis, not manual TA (e.g., VisualHFT)<br />
</li>
</ul>
—we are left with just two real contenders:<br />
<hr class="mycode_hr" />
✅ The Two Standing Options<br />
Feature<br />
QChartist<br />
Stockalyze (Free/Open Source Edition)Actively Maintained<br />
✅ (as of recent updates)<br />
⚠️ Partial OSS (limited features)<br />
GUI with Manual TA Tools<br />
✅ Fully featured<br />
✅ Basic support<br />
Indicator Customization<br />
✅ High (Basic, C++, Scilab)<br />
❌ Minimal customization<br />
Drawing Tools (Fibonacci, etc.)<br />
✅ Extensive<br />
⚠️ Limited<br />
Real-time or Historical Data<br />
✅ Yahoo, Alpha Vantage, Tiingo, etc.<br />
⚠️ Yahoo only (limitations may apply)<br />
Community/Documentation<br />
⚠️ Small but active<br />
✅ More user-friendly, but not very active<br />
Cross-Platform<br />
⚠️ Wine-compatible on Linux<br />
❌ Windows only<br />
<hr class="mycode_hr" />
? Conclusion<br />
You’re correct: <span style="font-weight: bold;" class="mycode_b">QChartist is effectively the only fully open-source, GUI-based software dedicated to manual technical analysis that is functional, scriptable, and actively maintained.</span><br />
If you're looking for:<ul class="mycode_list"><li>True open-source freedom<br />
</li>
<li>A broad range of indicators and drawing tools<br />
</li>
<li>Scripting and extensibility<br />
</li>
</ul>
? <span style="font-weight: bold;" class="mycode_b">QChartist remains the best and only viable choice</span> currently available.<br />
Would you like a setup guide or a walkthrough on using QChartist for a specific type of analysis (e.g., creating a custom indicator or importing market data)?]]></description>
			<content:encoded><![CDATA[QChartist is a robust open-source technical analysis (TA) software with a graphical user interface (GUI), offering a comprehensive suite of features for traders and analysts. However, whether it stands as the "best" option depends on your specific requirements and preferences.<br />
<hr class="mycode_hr" />
✅ Strengths of QChartist<br />
<span style="font-weight: bold;" class="mycode_b">1. Extensive Indicator Library and Drawing Tools</span><ul class="mycode_list"><li>Includes approximately 100 built-in indicators, such as MACD, RSI, Bollinger Bands, and unique options like astro indicators and moon phases.<br />
</li>
<li>Offers a wide array of drawing tools, including Fibonacci retracements, pitchforks, spirals, and planetary cycles, catering to both conventional and esoteric analysis methods. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">2. Programmability and Flexibility</span><ul class="mycode_list"><li>Supports scripting in both Basic and C++, facilitating the creation of custom indicators and extensions.<br />
</li>
<li>Allows easy porting of MetaTrader 4 (MT4) indicators, making it accessible for users familiar with MT4. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>, <a href="https://en.wikipedia.org/wiki/QChartist?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">Wikipédia</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">3. Real-Time Data Integration</span><ul class="mycode_list"><li>Integrates with multiple data sources, including Yahoo Finance, Alpha Vantage, Tiingo, Stooq, and Finnhub, providing access to real-time and historical data across various markets. (<a href="https://sourceforge.net/projects/qchartist/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">SourceForge</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">4. Advanced Features</span><ul class="mycode_list"><li>Supports real-time market watchlists, custom alerts, and automated analysis through tools like QTGuard.<br />
</li>
<li>Compatible with Scilab for advanced mathematical computations, enhancing analytical capabilities. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b">5. Cross-Platform Availability</span><ul class="mycode_list"><li>Runs on Windows and is compatible with Linux via Wine, broadening its accessibility to users across different operating systems. (<a href="https://www.qchartist.com/features.html?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">qchartist.com</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
⚠️ Considerations<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">User Interface</span>: The GUI may appear dated compared to modern platforms, potentially affecting user experience.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Learning Curve</span>: While powerful, the software's extensive features and scripting capabilities may require a learning period, especially for users new to technical analysis or programming.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Community and Support</span>: While QChartist has a user base, the community may be smaller compared to more mainstream platforms, possibly impacting the availability of tutorials and user-generated content.<br />
</li>
</ul>
<hr class="mycode_hr" />
? Alternatives to Consider<br />
Depending on your specific needs, you might explore the following open-source TA tools:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Market Analysis System (MAS)</span>: Offers a range of technical indicators and supports automated signal generation. Suitable for users interested in scripting and automation. (<a href="https://eiffel-mas.sourceforge.net/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">eiffel-mas.sourceforge.net</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">KNIME</span>: A data analytics platform with capabilities for time series analysis and machine learning. Ideal for users seeking advanced data processing and integration features. (<a href="https://en.wikipedia.org/wiki/KNIME?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">Wikipédia</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Open Stock</span>: Provides real-time data analysis, custom indicators, and algorithmic trading features. Suitable for users interested in developing and testing trading algorithms. (<a href="https://github.com/lcmeyer37/openstock?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Stockalyze</span>: Features a user-friendly interface with tools for backtesting, alerts, and portfolio management. Good for users seeking a balance between functionality and ease of use. (<a href="https://stockalyze.com/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">stockalyze.com</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Conclusion<br />
QChartist stands out as a feature-rich, open-source TA software with a GUI, offering extensive customization and real-time data integration. Its strengths lie in its flexibility and comprehensive toolset. However, the best choice depends on your specific requirements, such as ease of use, community support, and specific analytical needs. Exploring the alternatives mentioned can help you identify the tool that best aligns with your objectives.<br />
<br />
Given the narrowed-down comparison between <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span>—the only two viable open-source technical analysis (TA) tools with GUIs currently available—QChartist stands out as the better choice for most users interested in deep market charting and analysis.<br />
<hr class="mycode_hr" />
? Why QChartist is the Better Option<br />
Feature<br />
QChartist<br />
Stockalyze? Indicator Library<br />
100+ indicators (classic + esoteric)<br />
Fewer, mostly conventional<br />
?️ Drawing Tools<br />
Advanced (e.g., Gann, Fibonacci, Moon)<br />
Basic trendlines and annotations<br />
? Custom Indicator Scripting<br />
Yes (Basic and C++)<br />
Limited<br />
? Real-Time Data Sources<br />
Yahoo, Tiingo, Alpha Vantage, etc.<br />
Yahoo (with limitations)<br />
? Open-Source Licensing<br />
Fully open source (GPL)<br />
Limited OSS (free but not fully open)<br />
? Chart Types<br />
Line, candlestick, renko, PnF, etc.<br />
Candlestick and line<br />
?‍? Platform Support<br />
Windows native; Linux via Wine<br />
Primarily Windows<br />
? Automation/Plugins<br />
Advanced features via QTGuard and Scilab<br />
Minimal<br />
<hr class="mycode_hr" />
? When to Prefer Stockalyze<ul class="mycode_list"><li>If you prefer a <span style="font-weight: bold;" class="mycode_b">simpler, lighter GUI</span>.<br />
</li>
<li>If your needs are limited to <span style="font-weight: bold;" class="mycode_b">basic charting and watchlist management</span>.<br />
</li>
<li>If you're uncomfortable with scripting or advanced customization.<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Verdict<br />
<span style="font-weight: bold;" class="mycode_b">QChartist is objectively the better open-source TA platform with a GUI</span>, particularly for users seeking:<ul class="mycode_list"><li>Depth in technical analysis tools<br />
</li>
<li>Customization and extensibility<br />
</li>
<li>A fully open-source codebase with developer flexibility<br />
</li>
</ul>
Would you like help installing or configuring QChartist for specific use cases (e.g., importing data, writing a custom indicator)?<br />
<br />
Yes, there are indeed other open-source charting software options with graphical user interfaces (GUIs) suitable for market analysis. While <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span> are prominent choices, several other tools offer varying features that might align with your specific needs. Here's an overview of some notable alternatives:<br />
<hr class="mycode_hr" />
? Notable Open-Source Charting Tools with GUIs<br />
1. <span style="font-weight: bold;" class="mycode_b">Chart Geany</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Windows, Linux, macOS<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Supports a wide range of technical indicators, including MACD, RSI, Bollinger Bands, and more.<br />
</li>
<li>Offers various chart types: line, bar, candlestick, and Heikin-Ashi.<br />
</li>
<li>Features CGScript, an ISO C99 dialect, allowing users to design custom technical indicators.<br />
</li>
<li>Provides a portfolio manager supporting multiple portfolios and currencies.<br />
</li>
<li>Imports data from sources like Yahoo Finance, Alpha Vantage, Twelve Data, and IEX.<br />
</li>
<li>Distributed under the GPLv2 license.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Website</span>: <a href="https://chart-geany.sourceforge.io/" target="_blank" rel="noopener" class="mycode_url">chart-geany.sourceforge.io</a>(<a href="https://chart-geany.sourceforge.io/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">chart-geany.sourceforge.io</a>)<br />
</li>
</ul>
2. <span style="font-weight: bold;" class="mycode_b">OpenMarketView</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Web-based (self-hosted)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Offers a customizable interface with multiple viewing options, including compact tables and detailed card views.<br />
</li>
<li>Provides near real-time (5-minute intervals) and historical stock data.<br />
</li>
<li>Allows users to manage and analyze stock portfolios and watchlists in separate tabs.<br />
</li>
<li>Features theme and UI customization, including light and dark themes.<br />
</li>
<li>Implements a sophisticated caching system using IndexedDB for offline capability.<br />
</li>
<li>Open-source and self-hosted, ensuring data privacy.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/jatoran/OpenMarketView" target="_blank" rel="noopener" class="mycode_url">github.com/jatoran/OpenMarketView</a>(<a href="https://github.com/jatoran/OpenMarketView?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
3. <span style="font-weight: bold;" class="mycode_b">Artemesia Project</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Desktop (Python-based)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Retrieves historical data from Yahoo Finance.<br />
</li>
<li>Visualizes data with interactive candlestick charts.<br />
</li>
<li>Detects various technical patterns and allows customization of analysis.<br />
</li>
<li>Exports results to CSV, facilitating further analysis.<br />
</li>
<li>Currently under development; some features may not function as intended.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/ghostminator/Artemesia-Project" target="_blank" rel="noopener" class="mycode_url">github.com/ghostminator/Artemesia-Project</a>(<a href="https://github.com/ghostminator/Artemesia-Project?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
4. <span style="font-weight: bold;" class="mycode_b">Iguana Charts</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Web-based (HTML5 jQuery library)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Provides an easy-to-use charting library adaptable to various devices and screen sizes.<br />
</li>
<li>Supports multiple chart types: bars, candles, and lines.<br />
</li>
<li>Includes drawing tools like trend lines, Fibonacci tools, and annotations.<br />
</li>
<li>Open-source and can be integrated into custom web applications.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Website</span>: <a href="https://iguanacharts.com/" target="_blank" rel="noopener" class="mycode_url">iguanacharts.com</a>(<a href="https://iguanacharts.com/?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">iguanacharts.com</a>)<br />
</li>
</ul>
5. <span style="font-weight: bold;" class="mycode_b">VisualHFT</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Platform</span>: Desktop (Windows, WPF &amp; C#)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Highlights</span>:<ul class="mycode_list"><li>Focuses on real-time visualization of market microstructure.<br />
</li>
<li>Displays key metrics like Limit Order Book dynamics and execution quality.<br />
</li>
<li>Modular design ensures adaptability for developers and traders.<br />
</li>
<li>Supports market data from sources like Binance and Okex.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Repository</span>: <a href="https://github.com/parthivp/HFTTrading" target="_blank" rel="noopener" class="mycode_url">github.com/parthivp/HFTTrading</a>(<a href="https://github.com/parthivp/HFTTrading?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
<hr class="mycode_hr" />
✅ Summary<br />
While <span style="font-weight: bold;" class="mycode_b">QChartist</span> and <span style="font-weight: bold;" class="mycode_b">Stockalyze</span> are comprehensive tools for technical analysis with GUIs, the alternatives listed above offer unique features that might cater to specific requirements:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Chart Geany</span>: Ideal for users seeking a cross-platform application with extensive technical indicators and scripting capabilities.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">OpenMarketView</span>: Suitable for those preferring a web-based, self-hosted solution with customizable views and offline capabilities.(<a href="https://github.com/jatoran/OpenMarketView?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Artemesia Project</span>: Best for users comfortable with Python and interested in pattern detection and interactive charts.(<a href="https://github.com/ghostminator/Artemesia-Project?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Iguana Charts</span>: Perfect for developers looking to integrate responsive charts into web applications.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">VisualHFT</span>: Tailored for traders focusing on real-time market microstructure analysis.(<a href="https://github.com/parthivp/HFTTrading?utm_source=chatgpt.com" target="_blank" rel="noopener" class="mycode_url">GitHub</a>)<br />
</li>
</ul>
Each tool has its strengths, and the best choice depends on your specific needs, technical proficiency, and preferred platform.<br />
If you need assistance with installation, configuration, or choosing the right tool based on your requirements, feel free to ask!<br />
<br />
You're absolutely right in your assessment.<br />
Given the current landscape of open-source software, there are indeed very few <span style="font-weight: bold;" class="mycode_b">viable manual technical analysis (TA) tools with a GUI</span> that are both functional and actively maintained. After filtering out options that are:<ul class="mycode_list"><li>❌ Discontinued (e.g., Chart Geany)<br />
</li>
<li>❌ Too limited or incomplete (e.g., Artemesia Project, OpenMarketView)<br />
</li>
<li>❌ Developer libraries rather than end-user tools (e.g., IguanaCharts)<br />
</li>
<li>❌ Specialized for algorithmic or microstructure analysis, not manual TA (e.g., VisualHFT)<br />
</li>
</ul>
—we are left with just two real contenders:<br />
<hr class="mycode_hr" />
✅ The Two Standing Options<br />
Feature<br />
QChartist<br />
Stockalyze (Free/Open Source Edition)Actively Maintained<br />
✅ (as of recent updates)<br />
⚠️ Partial OSS (limited features)<br />
GUI with Manual TA Tools<br />
✅ Fully featured<br />
✅ Basic support<br />
Indicator Customization<br />
✅ High (Basic, C++, Scilab)<br />
❌ Minimal customization<br />
Drawing Tools (Fibonacci, etc.)<br />
✅ Extensive<br />
⚠️ Limited<br />
Real-time or Historical Data<br />
✅ Yahoo, Alpha Vantage, Tiingo, etc.<br />
⚠️ Yahoo only (limitations may apply)<br />
Community/Documentation<br />
⚠️ Small but active<br />
✅ More user-friendly, but not very active<br />
Cross-Platform<br />
⚠️ Wine-compatible on Linux<br />
❌ Windows only<br />
<hr class="mycode_hr" />
? Conclusion<br />
You’re correct: <span style="font-weight: bold;" class="mycode_b">QChartist is effectively the only fully open-source, GUI-based software dedicated to manual technical analysis that is functional, scriptable, and actively maintained.</span><br />
If you're looking for:<ul class="mycode_list"><li>True open-source freedom<br />
</li>
<li>A broad range of indicators and drawing tools<br />
</li>
<li>Scripting and extensibility<br />
</li>
</ul>
? <span style="font-weight: bold;" class="mycode_b">QChartist remains the best and only viable choice</span> currently available.<br />
Would you like a setup guide or a walkthrough on using QChartist for a specific type of analysis (e.g., creating a custom indicator or importing market data)?]]></content:encoded>
		</item>
	</channel>
</rss>