smallville wrote:Dileepa,
Can u also include or make some alterations in ur simulator to have the following, if its possible;
1) Enter initial investment and date quantity
2) Cash in hand and averaging to have "NO" value in case no more cash infusion
3) to have a buy/sell price box if we buy/sell omiting the signals of the system
Thanks for the suggestion.
1) & 2) is possible.
Need some time to think about 3) as it involves a lot of what if scenarios.
Will update this later.
smallville wrote:
For some counter like REEF (I just checked it cuz of hype..) the strategies are not working.. May I know what buy/sell strategy (50 day MA vs 14 day, MACD - RSI - SAR combined, etc..)
Have u tested different strategies to diff counters?
Yes I'm aware of the problem.
It is very difficult to have a universal signal generator.
As we discussed here ↓ it is better to test different strategies and identify which works for what
http://forum.srilankaequity.com/t23436-rsi-as-per-yahoo#140358
Signal generator in DFN sniffer use a combination of MA, RSI & some machine learning.
If you are interested, here is a sample code for DFN without machine learning part.
//------------------------------------------------------------Start
DataArray LMA = MovingAverage(Close, 20, Simple); // Simple 20 day MA of close price
DataArray SMA = MovingAverage(Close, 5, Simple); // Short Moving Average
DataArray LMAyest = ref(LMA,-1); // Long MA of yesterday
DataArray SMAyest = ref(SMA,-1);
DataArray LMA_2;
DataArray SMA_2;
DataArray LMAyest_2;
DataArray SMAyest_2;
DataArray LMA_3;
DataArray SMA_3;
DataArray LMAyest_3;
DataArray SMAyest_3;
DataArray BuyP;
DataArray Buy_L;
DataArray Buy_N;
DataArray SellP;
DataArray BarCount;
DataArray BuyBarCount;
DataArray SellBarCount;
DataArray Period = 0;
plot(Close,Orange,Solid,1.0); // Daily close price plot
// Sell Signal
if ((LMAyest < SMAyest) and (SMA < LMA)) then
// Search for previous Buy signal and fetch the Buy Price
for(int i = 120; i > 1; i = i-1) do
LMA_2 = ref(LMA,-(i-1));
SMA_2 = ref(SMA,-(i-1));
LMAyest_2 = ref(LMA,-i);
SMAyest_2 = ref(SMA,-i);
if((LMAyest_2 > SMAyest_2) and (SMA_2 > LMA_2)) then
BuyP = ref(Close,-i); // For safety check
end
end
SellP = Close;
end
// Buy Signal
if ((LMAyest > SMAyest) and (SMA > LMA)) then
// Search for previous Buy signal and fetch the Buy Price
for(int i = 120; i > 1; i = i-1) do
LMA_2 = ref(LMA,-(i-1));
SMA_2 = ref(SMA,-(i-1));
LMAyest_2 = ref(LMA,-i);
SMAyest_2 = ref(SMA,-i);
if((LMAyest_2 > SMAyest_2) and (SMA_2 > LMA_2)) then
Buy_L = ref(Close,-i);
for (int j = (i-1); j > 1; j = j-1) do
LMA_3 = ref(LMA,-(j-1))
SMA_3 = ref(SMA,-(j-1))
LMAyest_3 = ref(LMA,-j)
SMAyest_3 = ref(SMA,-j)
if((LMAyest_3 > SMAyest_3) and (SMA_3 > LMA_3)) then
Buy_N = ref(Close,-j);
end
end
end
if (Buy_N < Buy_L) then
BuyP = Buy_N;
else
BuyP = Buy_L;
end
end
end
// Real Signal
drawsymbol((LMAyest > SMAyest) and (SMA > LMA) and (Close < BuyP),BuyArrow,Green,Below); // Buy
drawsymbol((LMAyest < SMAyest) and (SMA < LMA) and ((BuyP*1.1) < SellP),SellArrow,Red,Above); // Sell
//------------------------------------------------------------End
1. Go to Tools -> Indicator Builder from DFN Charting.
2. Copy and past above code.
3. Click Test, Build and Save (Give a name)
4. Right Click on chart area -> Indicators -> Custom Indicators & Select above
Modify the code as necessary.
Ex: To insert a RSI limit so that it will not generate a BUY signal if RSI is above 80,
change the buy signal as follows
drawsymbol((LMAyest > SMAyest) and (SMA > LMA) and (Close < BuyP) and (RelativeStrengthIndex(Close, 14) < 80),BuyArrow,Green,Below); // Buy
You know the code, have fun