Data2
Posted: Nov 04 2019
Hi there I am having the data2 problem again. I know TJ advised how to handle it here (5):
viewtopic.php?f=16&t=6929
But still not working. Here is the indicator I am using with datafeed 1 and 2. Dont worry about the formulas and data1 (as data1 can be every TF as long as< then data2).
So basically everything you see in here shall reference to data2. Also please be advised that I am using ADE to gather OHLCV Daily data from another symbol for one condition. I know its wotking if there is just data1:
viewtopic.php?f=16&t=6929
But still not working. Here is the indicator I am using with datafeed 1 and 2. Dont worry about the formulas and data1 (as data1 can be every TF as long as< then data2).
So basically everything you see in here shall reference to data2. Also please be advised that I am using ADE to gather OHLCV Daily data from another symbol for one condition. I know its wotking if there is just data1:
Code: Select all
inputs:
Coef( .2 ),
VCoef( 2.5 ),
VFIPeriod( 130 ),
VFISmoothedPeriod( 3 ),
MA100Length( 100 ),
Trigger(3),
low_(5),
RSI_Up(70),
Trailpoints(5),
D1( 3 ),{DAYS FOR RS Moving Average}
Per1(3),Per2(8),Off1(0),Off2(2),
RSI_(30),
MA_neu(200),g(2),
Rsi_Length(14),
MAD( 100 ), //DAYS FOR MA
TRD(60), //DAYS FOR TREND
XMA(3),
Tage_(63),
Stoploss_(0.04),
Interval(ADE.Daily), // number of minutes, or ADE.Daily, ADE.Weekly, ADE.Monthly
UseFile(ADE.UseFile);
variables:
oCutOff( 0,data2),
oVC( 0,data2 ),
oMF( 0,data2 ),
oVFI( 0,data2 ),
VFI( 0,data2 ),
MyVolume_( 0,data2 ),
MA100Value( 0,data2 ),
Stiffness( 0,data2 ),
MktTrendAvgVal( 0,data2 ),
Cond1( 0,data2 ),
Cond2( 0,data2 ),
Cond3( 0,data2 ),
Cond4( 0,data2 ),
Cond5( 0,data2 ),
Cond6( 0,data2 ),
Cond7( 0,data2),
Cond8( 0,data2 ),
Cond9( 0,data2 ),
Cond10( 0,data2 ),
Cond11( 0,data2 ),
Cond1Weight( 0,data2 ),
Cond2Weight( 0,data2 ),
Cond3Weight( 0,data2 ),
Cond4Weight( 0 ,data2),
Cond5Weight( 0,data2 ),
Cond6Weight( 0,data2 ),
Cond7Weight( 0,data2 ),
Cond8Weight( 0,data2 ),
Cond9Weight( 0,data2 ),
Cond10Weight( 0,data2 ),
Cond11Weight( 0,data2 ),
Count(0,data2),
Condition_neu1(0,data2),
ConditionSum_Trigger( 0,data2 ),
ConditionSumBasis(0,data2),
ConditionSumGesamt(0,data2),
ConditionSum_( 0,data2 ),
Condition_neu(false,data2),
dir(0,data2),
Lin(0,data2),
upCount(false),
IM(0,data2),INTERMARKETRS(0,data2),
Differenz(0,data2),
hh1(0,data2),
hh2(0,data2),
ll1(0,data2),
ll2(0,data2),
line1(0,data2),
line2(0,data2),
MA(0,data2),
CLMA(0,data2),
PERS(0,data2),
Close2(0,data2),
High2(0,data2),
Low2(0,data2),
Volume2(0,data2),
Class("OHLCV"),
InfoMap(MapSN.New),
Index(0),
PrevIndex(0),
MyOpen(0),
MyHigh(0),
MyLow(0),
MyClose(0),
MyVolume(0);
if CurrentBar = 1 and UseFile then
Value1 = ADE.OpenMap(Class, GetSymbolName, Interval);
// Retrieve the OHLCV data for this symbol and bar interval.
PrevIndex = Index;
Index = ADE.GetOHLCV("SPY", Interval, ADE.BarID, MyOpen, MyHigh, MyLow, MyClose, MyVolume);
Close2=Close data2;
High2=High data2;
Low2=Low data2;
Volume2=Volume data2;
MA=AVERAGE(Close2,MAD)data2- .2 *StdDev( Close2, MAD )data2 ;
CLMA=IFF(Close2<MA,1,0)data2;
PERS=CLMA+TRD;
STIFFNESS=(TRD-PERS)*100/TRD;
hh1 = Highest(High2, Per1)data2 + Off1 * Tick;
ll1 = Lowest(Low2, Per1)data2 - Off1 * Tick;
hh2 = Highest(High2, Per2)data2 + Off2 * Tick;
ll2 = Lowest(Low2, Per2)data2 - Off2 * Tick;
If Close2 > line1[1] then
line1 = ll1
else
line1 = hh1;
If Close2 > line2[1] then
line2 = ll2
else
line2 = hh2;
If Close2 > line1 and Close2 > line2 then begin
dir = 1;
end else If Close2 < line1 and Close2 < line2 then begin
dir = -1;
end;
MyVolume_ = iff( BarType < 2, Ticks, Volume2 )data2;
VFI = VFISmooth(Coef, VCoef, VFIPeriod, VFISmoothedPeriod,
MyVolume_, oCutOff, oVC, oMF, oVFI )data2 ;
if VFI > 0 then
Cond1 = Cond1Weight
else
Cond1 = 0 ;
// Calculate MA100
// For Conditions 2 and 3
MA100Value = Average( Close2, MA100Length )data2 ;
if Close > MA100Value then
Cond2 = Cond2Weight
else
Cond2 = 0 ;
if MA100Value >= MA100Value[3] and MA100Value >= MA100Value[4] and MA100Value >= MA100Value[5] then
Cond3 = Cond3Weight
else
Cond3 = 0 ;
// Calculate Stiffness for Cond4
Stiffness = Countif( Close2 < MA100Value, 63 )data2 ;
if Stiffness < 7 then
Cond4 = Cond4Weight
else
Cond4 = 0 ;
INTERMARKETRS=XAVERAGE(Close2/MyClose,3)data2;
if INTERMARKETRS> Average(INTERMARKETRS,D1) and (INTERMARKETRS>INTERMARKETRS[1] and INTERMARKETRS>INTERMARKETRS[2]and INTERMARKETRS>INTERMARKETRS[3]) or
(INTERMARKETRS>INTERMARKETRS[1] and INTERMARKETRS<INTERMARKETRS[2]and INTERMARKETRS>INTERMARKETRS[3]) then
Cond5 = Cond5Weight
else
Cond5 = 0 ;
if low<lowest(Close2,low_)data2 then
Cond6 = Cond6Weight
else
Cond6 = 0 ;
if RSI(Close2,Rsi_Length)data2<RSI_Up then
Cond7 = Cond7Weight
else
Cond7 = 0 ;
if MyClose[1]>Average(MyClose,200) and MyClose[2]>Average(MyClose,200) and MyClose[3]>Average(MyClose,200)
and MyClose[6] >Average(MyClose,200) then
Cond8 = Cond8Weight
else
Cond8 = 0 ;
if dir = 1 then
Cond9 = Cond9Weight
else
Cond9 = 0 ;
ConditionSumBasis=Cond6 + Cond7 + Cond8 + Cond9 ;
ConditionSumGesamt=ConditionSumBasis+ConditionSum_Trigger;
ConditionSum_=Cond10+Cond11;
Lin=7;
if RSI(Close2,Rsi_Length)data2>RSI_Up then
Cond11 = Cond11Weight
else
Cond11 = 0 ;
ConditionSum_Trigger = Cond1 + Cond2 + Cond3 + Cond4 + Cond5;
If ConditionSum_Trigger=4 and ConditionSumBasis=4 then begin upCount = true;
end;
If RSI(Close2,Rsi_Length)data2>RSI_Up or (close2>close2[count] and dir=-1) or count>99 or close2[count]<close2-(close2*Stoploss_)then upCount = false;
If upCount = false then count=0;
if upCount = true then begin
count = count + 1;
end;
Plot3(Count, "Counter" ) ;