Gekko Forum
How do you code ideas that keep track of things that happened in the past? - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Strategy Development (https://forum.gekko.wizb.it/forum-12.html)
+--- Thread: How do you code ideas that keep track of things that happened in the past? (/thread-57892.html)



How do you code ideas that keep track of things that happened in the past? - boba - 04-01-2019

For example if LineA > LineB, you know LineA crossed from below to above LineB at some point, but when?

And how would you do the "below to above" part?

They cross when LineA.value === LineB.value, but would you have to store the previous candle to know if it is coming from below to above or above to below?

Is there an easy way to do previous N candles or get the time at and time since the last cross happened?


RE: How do you code ideas that keep track of things that happened in the past? - Highwater - 04-02-2019

Use an array.
Populate the array with your indicator results.
Then compare.