CBT Question - Signal Order

Hello friends.

I have a simple question.

When using GetFirstSignal/GetNextSignal, if there are an entry signal (scalein) and an exit signal at the same bar, which of them will be the "FirstSignal"?

Entry Signals always come first?

Taking into account I just want the system to proccess signals at a certain order, and dont want to change anything else, I ask:

What if I want it to always process the entry first (scalein) and the exit last (get out of the whole position), how should I code it in the CBT section?

Thank you very much, friends!!!

The safest thing is to not assume anything about the order of the signals, other than the fact that entry signals are guaranteed to be ordered by position score.

If you want to process entries first, then iterate through all the signals with GetFirstSignal/GetNextSignal and only process the ones where sig.IsEntry() is true. When you're ready to do the exits, then iterate through all the signals again and only process the ones where sig.IsExit() is true.

2 Likes

Do I need Low-Level to be able to do this or just Mid-Level would suffice?

Within CBT GetFirst/NextSignal calls, entry signals come first, exit come afterwards. Within entry signals they are ordered by position score. Exit signals don't have specific order (they would be almost alphabetical but due to the fact that multiple threads running in parallel generate signals, exact ordering is not guaranteed).
Scale in/out are interleaved with exits in CBT's GetFirst/NextSignal.

1 Like

Thank you both for your kind answer. Im gonna try studying more.

That's a common result around here!

if( Question_Answered == True)
     I have new info to study;
else
     I need to write a better question;

:upside_down_face:

3 Likes