Entry to work for a range of bars after my trigger?
Author: angel57
Creation Date: 9/28/2008 12:28 AM
profile picture

angel57

#1
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?
profile picture

Eugene

#2
Although the link's for WL4, everything but the syntax applies to WL5:
Tutorial: Setups, Triggers, Delays, and Timeouts
profile picture

angel57

#3
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?
profile picture

Cone

#4
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.
profile picture

Eugene

#5
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.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).