 |
|
|
|
|
|
|
 |
|
|
|
|
|
|
 |
|
Percentage Swing Code Assistance
Last Post 10-15-2009 08:09 PM by Robert Stefanovic. 2 Replies.
|
Sort:
|
|
Prev Next |
You are not authorized to post a reply. |
|
Robert Stefanovic
 New Member Posts:2
 |
| 10-15-2009 05:46 PM |
|
I am just getting started with Tradersstudio and was looking to code a percentage swing system (x% move up or down from a recent high or low) similar to the 4% Swing system popularized by Ned Davis and Martin Zweig. Has anyone coded this or can offer some suggestions?
Thanks for any assistance!
Scipio
|
|
|
|
|
mur ang
 Advanced Member Posts:525
 |
| 10-15-2009 07:27 PM |
|
' Code For the Zwieg 4% rules with Input For percent ' TradersStudio(r) (c) 2006,2007 all rights reserved. Sub My4Percent(LongPct, ShrtPct) Dim Counter As BarArray Dim LongHi As BarArray Dim ShortLo As BarArray
If BarNumber=FirstBar Then 'LongPct = 4 'ShrtPct = 4 Counter = 0 LongHi = C ShortLo = C End If
Counter = Counter + 1 If Counter = 1 Then LongHi = C ShortLo = C End If If MarketPosition <> 1 And C >= ShortLo * (1 + LongPct/100) Then Buy("", 1, 0, CloseEntry, Day) LongHi = C End If If MarketPosition <> -1 And C <= LongHi * (1 - ShrtPct/100) Then Sell("", 1, 0, CloseEntry, Day) ShortLo = Close End If If MarketPosition <> -1 And C > LongHi Then LongHi = C End If If MarketPosition <> 1 And C < ShortLo Then ShortLo = C End If End Sub
|
|
|
|
|
Robert Stefanovic
 New Member Posts:2
 |
| 10-15-2009 08:09 PM |
|
Thanks Murray much appreciated! I will try and digest to make sure I understand how you got there. Teach a man to fish...:) |
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved
Terms Of Use
Privacy Statement
|