Fortuna
OnBarUpdate()
There is new information about the bar being processed. This starts processing with the very first bar of the chart and is called every time the bar has something different from the last time it was called. It's essentially called and this logic is processed with every tick starting from tick 1 on the chart through the most recent tick of the chart.
OnPositionUpdate()
There is new information about a Position.
Long Position
Short Position
Flat Position
Are there enough bars loaded to process what to do?
No
Yes
Return. Stop processing this Bar Update any further
What time is it?
4:30pm - 5pm
Close any open positions, then Return to stop processing any further
9:00am - 10:59am
6:50am - 8:59am OR 11am - 4:00pm
Does a Current Position Exist?
No
Gather Market Conditions
If Short Entry Exists
If Long Entry exists
Yes
Update Position information, like Peak PnL
Does EXIT Condition Exist? Trail Stop -20%, max loss for day, etc
Yes
No
Set SL, Set PT, and Enter Long
Set SL, Set PT, and Enter Short
Update SL and PT with proper levels now that we know the average entry level
Update SL and PT with proper levels now that we know the average entry level
Reset any variables that need resetting