Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Just to be clear I didn't change any of your calculation logic. Just separated them into two studies to be able to easily test and visualise the different sections.
Let me know the outcome.
Can you help answer these questions from other members on NexusFi?
I fully understand. I tested the trading algo study alone without the trading study and I am still observing the unexpected behavior of subgraphs L2_Buyer/Seller. I will continue checking what could be the root cause?
I have compared again and reviewed the code and the charts. It is noted in the two attached charts that:
The Trading Algo study L2_Seller in this example is not aligned with the L2_Seller that is generated from the same code but using Sierra Spreadsheet ---
Look at how the purple line is changing in both of the charts...
There are 6 events generated from the spreadsheet and it all took place when we close above then we close below the Donchian channel High...
There are only 4 events generated from our ACSIL Trading Algo study...
Notice as well the stairstep changes in both are not aligned and it is as expected from the spreadsheet. I don't think the code is incorrect as it is the same code but one in spreadsheet and the other in ACSIL while we import the array of the Donchian Channel but in the case of the spreadsheet, the donchian channel is a column in the spreadsheet.
One idea to get to the bottom line is to generate the imported array as a subgraph to plot it and compare it with the original Donchian channel and see if they are aligned or not ....
Please slowly go through each bar and print to log the values as they process. That is THE ONLY WAY to debug!!!!!
Its all pretty easy to do, I've even given you debug code (true/false code) but for some reason weeks later your still not doing it. For example show me the log prints where the X subgraph is 3752 and you believe it should be 3755.
I do apologize, I thought that this is clear -- However, this is the debug log that you are requesting and it is clear from the log that the array is mis-aligned with the actual Donchian Channel...
DC_High[Index-2] = 3755.75 though in the actual Donchian Channel study it is 3749.25 ..
This implies that the imported array is misaligned with one bar , and it updates earlier than expected.
In this case, we closed above the DC_High at Index-2 and Closed below DC_High at Index-1, so it should make an L2_Seller but due to the change that is earlier than expected the DC_High [Index-2] is changing to equal the DC_High[Index-1] and this will not trigger the condition.. Hope that is clear this time and let me know if you need any more information ... I am not sure why the importing of the array is doing that behavior...
When writing code keep different function separate and test each one to ensure they work as expected.
IF they don't work as expected have a look at one time it didn't work as expected and look at the values very closely bar by bar to see what values your study is using, what code is producing those values and why. Is the logic correct, are the bar indexes correct that you are referencing. You do that by printing to a log and visualising each bar.
Thanks a lot for your help and great support. Yes, it is a very good lesson to know that the Donchian Channel by Sierra would have that shift. However, the spreadsheet study with the same code was working fine. The donchian channel study as it prints on the subgraph is the correct behavior. It is supposed to switch its value when we make a new high for the range at the next bar after the last.... Will check if they do this by shifting the graph as was shown in the code or it is inherent in the logic.
I will need to change the code reference indexes to align with that shift in the Donchian Channel study from Sierra