| jas0501 |
|
Gold User, Member, TeleChart
|
| Registered User |
|
|
|
|
| Unsure |
|
| Saturday, December 31, 2005 |
| Friday, September 10, 2010 7:10:24 PM |
2,182 [1.06% of all post / 1.27 posts per day] |
|
|
Bruce based on your previous comments the cumulative directive could be removed if the code was changed as below. Granted the first "Period" bars would not plot the sum, but the performance for watchlist columns would be optimal.
With the added capability of dynamic lookback for watchlist column calculation, the use of
'# cumulative
unnecessary, if the code is properly written to plot single.NAN for the first "period" bars.
Correct?
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Accumulation Oscillator
'|******************************************************************
'# Period = UserInput.Integer = 200
Static Sum As Single
If isFirstBar Then
Sum = 0
Else If Price.Last > Price.Last(1) Then
Sum += Volume.Value * Price.Last
Else If Price.Last < Price.Last(1) Then
Sum -= Volume.Value * Price.Last
End If
If CurrentIndex > Period Then
If Price.Last(Period) > Price.Last(Period + 1) Then
Sum -= Volume.Value(Period) * Price.Last(Period)
Else If Price.Last(Period) < Price.Last(Period + 1) Then
Sum += Volume.Value(Period) * Price.Last(Period)
End If
Plot = Sum
else
plot = single.NAN
End If
|
QUOTE (hklala) I am new to this programming world. Telechart functions are easy..Need help to code this in Stockfinder.. thanks in advance..
50 * (C - XAVGC3.1) / 2 /
(.5 * (ABS(C - C1) +
.5 * (ABS(C1 - C2) +
.5 * (ABS(C2 - C3) +
.5 * (ABS(C3 - C4) +
.5 * (ABS(C4 - C5) +
.5 * (ABS(C5 - C6) +
.5 * (ABS(C6 - C7) +
.5 * (ABS(C7 - C8) +
.5 * (ABS(C8 - C9) +
.5 * (ABS(C9 - C10) +
.5 * (ABS(C10 - C11) +
.5 * (ABS(C11 - C12) +
.5 * (ABS(C12 - C13) +
.5 * (ABS(C13 - C14))
)
)
)
)
)
)
)
)
)
)
)
)
)
) + 50
reformatted
|
One way:
Run 1. Buy on open and sell on next open
Run 2. Buy one close and sell on next open
(Run 1 - Run 2) is equal to Buy one open sell on close
|
No. You can however with the use of label get a single indicator to export multiple indicators.
For example
'# MA1 ...
'# MA2 ...
'# MA3 ...
label = MA1.value & "," & MA2.value & "," MA3.value
plot = (MA1.value + MA2.value + MA3.value)/3
would output 4 values
|
also note that the candlestick patterns are relacode and you can borrow the code and edit them to better fit your taste.
Also note the the more bars in your pattern the fewer occurrances to track and the less statistically sound the results give the smaller sample size.
|
|
Another way of sys it is that ATR include the gap ii present from yesterday's close.
So ATR/TrueRange is greater than or equal to 1. The bigger the number the gappier the symbol.
|
It would be better if StockFinder added some intelegence to detect the data span needed by the indicator and set the bars used in column calculations.
'# Cumulative
is heavy handed and requires all data to be used. If the last value only need 100 bars then the performance will suffer. If Stockfinder detects that span of data uses and set it to 100. then 5000 vs 100 would be a vast performance improvement.
There is another undocumented directive, (I can't recall what it is, maxbars maybe) for setting the number of bars, so 5 years of data would be using something like 1260+, (5*252), bars and would be about 4x faster than using 5000.
|
Try adding
'# cumulative
as 5 years worth of bars are needed to calculate the value.
Also instead of multiplying by 100 you can change the display format from 0.00 to 0.00% or 0.000% or whatever precision you like.
|
QUOTE (davidjohnhall) What if you Stoplossed MSFT at 20% below entry? Ten years of nothing.
This is why it's important to incorporate a time stop into your method. I do this by looking at the types of stocks I trade and the type of movement that I'm looking for and backtesting and live trade record keeping has given me the distribution of time periods in which those moves occur. For example, I know that 90% of the moves I'm looking for occur within 60 days so I have a hard stop at 60 days and many times much sooner if nothing is happeneing. Most of the time if some type of initial move has not occured by 20 days the trade is closed.
The decreasing stop of x% and essentially a timed exit since if the price isn't moving more than x% per day the stop is closing in on the price.
|
|
I too have found that a 20% stoploss provides the best backtesting returns, disregarding the stomach acid factor.
The reason is that stops are typically loss captures. By setting the stop at 20% any losses of less than 20% have an opportunity to regain some of the loss. The sum of the regained amount exceeds the loss captured by an x% stop loss.
One other type of stop to consider is a linear degrading stop. Day one is at -20% and for each day of the trade it increases by some % . So after n days the stop would at breakeven and after 2*n days would be at a 20% gain. This type of exit can be paired nicely with a profit target exit to produce a workable approach.
|
|