Probably an easy solution to this, but I am drawing a blank on how to make it work. I would like to execute a BuyAtStop, after my signal triggers a buy, for a few cents above the high of the last bar that generated the trigger. However, sometimes the price reverses too quickly, then retraces back to my buy price a few bars later. The BuyAtStop method only works for a particular bar and not a range of N bars after my trigger. Any suggestions/examples on how to implement a BuyAtStop that is valid for the next N bars, or waits some period of time for the price to get there?
Size:
Color:
Size:
Color:
One followup question: If I use a boolean variable to establish that the signal has triggered and then test every N bars for retracing above the price, how do I handle multiple triggers that have yet to become Positions, or can I establish a Pseudo-position until it becomes a real position?
Size:
Color:
Re: Pseudo-position
What's that? Positions are like being pregnant. You are or you aren't.
Multiple triggers -> multiple variables
The easiest way to determine if a condition has occurred within x bars is to create a series (one for each condition) that contains the most-recent bar of the "true" state of the condition - indicators like HighestBar, LowestBar, PeakBar, and TroughBar are ready-made for that. Also, Version 4 has a couple custom indicators, CrossOverBar and CrossUnderBar, that we need to add to the Community.Indicators pack.
The point is that once you have such an indicator, you only need to subtract it from the current bar to determine if it's within "N bars".
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
Also, Version 4 has a couple custom indicators, CrossOverBar and CrossUnderBar, that we need to add to the Community.Indicators pack.
Community.Indicators has just been updated to include CrossOverBar, CrossUnderBar, CrossOverValueBar and CrossUnderValueBar.
Size:
Color: