[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Need Help (Tomasz)



PureBytes Links

Trading Reference Links

Jim,

Here is a solution: use RSIA() function.

You can elimante the Lastvalue(). and when you run explore you will see
the values of RS change..

Bull=9;

Bear=-3;

Trend = IIf(Bull<ROC(EMA(C,50), 14),1,IIf(Bear<ROC(EMA(C,50), 14),2,3));

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

B =IIf(Trend == 1,17,IIf(Trend == 2,63, 22));

S =IIf(Trend == 1,58,IIf(Trend == 2,79, 83));

RS=IIf(Trend == 1,14,IIf(Trend == 2,7, 4));
//RS=LastValue(RS);//****Added***/

//RS1=IIf(Trend == 1,14,IIf(Trend == 2,7, 4));

Filter=1;

AddColumn(Trend,"Trend");

AddColumn(B,"B",1);

AddColumn(S,"S",1);

AddColumn(RS,"RS",1);

//AddColumn(ValueWhen(DateNum()==1011018,rs1),"");

AddColumn(ROC(EMA(C,50), 14),"ROC");



StochRsi=EMA((RSIa(RS)-LLV(RSIa(RS),8))/(HHV(RSIa(RS),8)-LLV(RSIa(RS),8)),3)*100;




Buy=Cross(B,StochRsi) AND ADX(14) > 20 AND RSI(4)<50;

Sell=Cross(StochRsi,S)AND ADX(14) > 13 AND RSI(4)>50;

Short=Sell;Cover=Buy;

Plot(Stochrsi,"stochrsi",colorRed,styleLine);
Title=WriteVal(rs);



Jim Hutchison wrote:

>  For Back test results I want to use the value for RS:    if Trend =
> 1,
> RS =14, or if Trend = 2,  RS =7, or if Trend = 3,  RS =4 .
> Is that what will happen or will it use the value from the last data
> point: if Trend = 2,  RS =7.  I want the RS value to reflect the value
>
> of the current day on each day of the back test.
>
> Thank You
>
> Jim Hutchison
>
> -----Original Message-----
> From: Anthony Faragasso [mailto:ajf1111@xxxxxxxx]
> Sent: Tuesday, February 18, 2003 12:01 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Need Help (Tomasz)
>
> Jim,.
>
> I sent you the post and explained that it returns the lastvalue as of
> the last data point in your database.....So, if today the lastvalue is
>
> RS=7, you will see that number in your explore results...
>
> Anthony
>
> Jim Hutchison wrote:
>
> > When run Explore I get the attached results after I added LastValue
> > () to my formula.RS is always 7 regardless if Trend is 1 or 2 or 3.
> >
> > Thank You
> >
> > Jim Hutchison
> >
> > -----Original Message-----
> > From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
> > Sent:Tuesday, February 18, 200311:15 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: Re: [amibroker] Need Help
> >
> > Jim,
> > IIF always returns array while RS accepts only number. To convert
> use
> > LastValue:
> > RS= LastValue ( IIf(Trend == 1,14,IIf(Trend == 2,7, 4)) );
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >
> >      ----- Original Message -----
> >      From: Jim Hutchison
> >      To: amibroker@xxxxxxxxxxxxxxx
> >      Sent:Tuesday, February 18, 20032:55 PM
> >      Subject: [amibroker] Need Help
> >
> >      When I try to back test the fowling program I get this AFL
> >      Error message:
> >
> >      Bad args.
> >
> >      0-th argument of function call has invalid (or unsupported)
> >      type at line 20, column 21:
> >
> >      StochRsi=EMA((RSI(RS)
> >
> >      --------------------^
> >
> >      I can not figure out why the RS variable does not work and
> >      the B and S variable work fine.
> >
> >      Bull=9;
> >
> >      Bear=-3;
> >
> >      Trend
> >      = IIf(Bull<ROC(EMA(C,50), 14),1,IIf(Bear<ROC(EMA(C,50),
> 14),2,3));
> >
> >      //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >
> >      B =IIf(Trend == 1,17,IIf(Trend == 2,63, 22));
> >
> >      S =IIf(Trend == 1,58,IIf(Trend == 2,79, 83));
> >
> >      RS=IIf(Trend == 1,14,IIf(Trend == 2,7, 4));
> >
> >      Filter=1;
> >
> >      AddColumn(Trend,"Trend");
> >
> >      AddColumn(B,"B");
> >
> >      AddColumn(S,"S");
> >
> >      AddColumn(RS,"RS");
> >
> >      AddColumn(ROC(EMA(C,50), 14),"ROC");
> >
> >
> >
>
> ochRsi=EMA((RSI(RS)-LLV(RSI(RS),8))/(HHV(RSI(RS),8)-LLV(RSI(RS),8)),3)*
>
> 100;
> >
> >      Buy=Cross(B,StochRsi) ANDADX(14) > 20ANDRSI(4)<50;
> >
> >      Sell=Cross(StochRsi,S)ANDADX(14) > 13ANDRSI(4)>50;
> >
> >      Short=Sell;Cover=Buy;
> >
> >      Thank you
> >
> >      Jim Hutchison
> >
> >      Post AmiQuote-related messages ONLY to:
> >      amiquote@xxxxxxxxxxxxxxx
> >      (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> >      Check group FAQ at:
> >      http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> >      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >      Service.
> >
> >
> >
> >
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
> >
> >
> >                    Yahoo! Groups Sponsor
>                         ADVERTISEMENT
>
>
> >
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
>
>                    Yahoo! Groups Sponsor
                        ADVERTISEMENT


>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/