Page 1 of 1

### Signal help -- stop and reverse

Posted: 12 Jan 2007
Hi All
Could someone assist with the code for a “stop and reverse signal” that does the following :

If H<H[1] and C > 5 points below H, then
Sell (to close long position) and sell (to open short position)

If L>L[1] and C > 5 points above L, then
Buy (to close short position) and buy (to open Long position)

Thanks
Milton

Posted: 12 Jan 2007
Milton,

this should do it for you.

Code: Select all

``` Inputs: MinTicks (20); //put the number of ticks your Close has to be above/below the Low/High for a trade Variables: MyTick (0), TicksToClose (0); If CurrentBar = 1 then begin MyTick = MinMove/PriceScale; //calculates the minimum price move for a share or contract TicksToClose = MyTick * MinTicks; end; {Start with ShortTrades} If High < High[1] and (High - Close) > TicksToClose then SellShort ("SEntry") this bar at Close; {Start with Long Trades} If Low > Low[1] and (Close - Low) > TicksToClose then Buy ("LEntry") this bar at Close; ```
ABC

Posted: 12 Jan 2007
ABC
Thanks for quick response
It works well, except it plots too many times, maybe has something to do with the selection of H[1] & H and also L[1] & L
For example, once entry is made, then there should not be another signal until the exit is made based on the attached
screenshot showing a yellow line that follows prices 4 points below and above price,and where the signals should occur

Thanks
Milton

Posted: 12 Jan 2007
milton,

only to make sure, does the Input settings of the Signal reflect those 4 points or is it still set to 20 (i.e. 5 points in E-Mini S&P for example)?

Edit:

The reserved word High is the High of the current Bar and High[1] the High from the preceding bar. If I interpret your screenshot correct, you dont't want the High and Lows, but the Swing-Highs and - Lows.

Posted: 12 Jan 2007
Hi ABC

.....only to make sure, does the Input settings of the Signal reflect those 4 .points or is it still set to 20 (i.e. 5 points in E-Mini S&P for example)?

The setting is based on trial and error,chart preference and the preferred time frame that you trade.It(the signal) is based on the distance the yellow line is set from high and low
They can be 4,10,20,40 and larger.The larger the setting the larger the chart compression

An input to alter settings would help and a plot to color long and short trades will make it more visually ....But I am not asking you for these
Basically trading the failure swings on any time frame chart

.......The reserved word High is the High of the current Bar and High[1] the High from the preceding bar. If I interpret your screenshot correct, you dont't want the High and Lows, but the Swing-Highs and - Lows.

Yes it appears that the Swing Highs and Swing lows
Sorry for my misunderstanding of what I was looking for
Milton

Posted: 13 Jan 2007
Again I wish to thank ABC for the input

Having thought about what I require, have decided to set out below details of a system that I have been trading on a manual basis, although do have some other ELa's that do parts of this request having cost many \$US’sss. It is time to put it down on paper, and test some strategies in MultiCharts, but I dont have the programming skills
I am willing to share whatever I have on the topic, in exchange with someone who is willing and able to complete the programming

I can be contacted on this forum or by private email

The following signal is based on price only, and trades the “failure swings”

An indicator would be handy to see the entry/exit points, but is not essential, but the signal must be based on the SwingPoints created by the below XPointsLine

Inputs:
XPointsLine (4) A line that follows XPoints(Variable input) below each successive the high, does not retreat on lower highs(Line goes sideways on chart on lower highs) and follows up under each higher high
But when close below XPointsLine then “switch”(bit like a parabolic switches) to then follow above each successive the low, does not retreat on higher lows(Line goes sideways on chart on higher lows) and follows down above each lower low
When close above XPoints low, “switch” to line now following below high as per above and so on

SwingPoint confirmation
If close below XPointsLine then fix the last highest High as SwingHigh
If close above XPointsLine then fix the last lowest low as SwingLow

Signal
Inputs:

XPoints (4); // The number of ticks price must close to
register a SwingHigh[H(1)and H] and SwingLow[L(1)and L]
based on the above XPointsLine

ShortStop (3) //The number of ticks that price must close above
SwingHigh [H] to close “SellEntry”

LongStop (3) //The number of ticks that price must close below
SwingLow [L] to close “LongEntry”

StopReverse (6)//If stop is initiated, then SAR--reverse
position, price now possibly trending in
opposite direction

NewStop (0) // If StopReverse is initiated, then NewStop now at
previous SwingPoint

****///The following was kindly provided by ABC///****
If SwingHigh < SwingHigh[1] and (SwingHigh - Close) > XPoints then

SellShort ("SellEntry") this bar at Close;

If SwingLow > SwingLow[1] and (Close - Low) > XPoints then

Buy ("LongEntry") this bar at Close;

ColorBars
Input on/off
Color Short trades magenta
Color Long trades cyan

If possible label chart with a letter H (on/of input,color,size,distance above swinghigh variable etc)
Also label swingLows with letter L
Excellent if the Labels would change as new highs and lows are made in real time
Makes the chart very visual
Don’t need any indicators or targets as this is trading price only

Hope someone is willing to help
Have attached a screenshot
Milton

Posted: 13 Jan 2007
Hi All
Appologies,the last attachment did not show the correct Exit/Entry points
Sorry!!,attached is corrected version
Milton