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

[amibroker] Re: Code modification Please



PureBytes Links

Trading Reference Links

Thank you very much Mike, I take hard time with it. 

Thanks again
Regards




--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> 
> Hi,
> 
> After a quick test, I believe that comparing the SelectedValue of
> BarSinceCrossgreen vs. BarSinceCrossred will give you what you want.
> Basically, you want to know which occured most recently (i.e. which has
> had fewer bars pass since it happened).
> 
> One_Houre_Green_Cross = Cross( MACD(), Signal() );
> One_Houre_Red_Cross = Cross( Signal(), MACD() );
> BarSinceCrossgreen = BarsSince( One_Houre_Green_Cross );
> BarSinceCrossred = BarsSince( One_Houre_Red_Cross );
> BarSinceCrossUp = StrFormat( " %g ", BarSinceCrossgreen, SelectedValue(
> ROC( C, 1 ) ) );
> BarSinceCrossDown = StrFormat( " %g ", BarSinceCrossred, SelectedValue(
> ROC( C, 1 ) ) );
> 
> GfxSelectFont( "Arial", 12, 700 );
> GfxSetBkMode( 1 );
> pxHeight = Status( "pxchartheight" );
> t = pxHeight;
> x5 = 101;
> 
> if ( SelectedValue( BarSinceCrossGreen ) < SelectedValue(
> BarSinceCrossRed ) )
> {
>      offset = 50;
>      GfxSetTextColor( colorGreen );
>      GfxTextOut( BarSinceCrossUp, x5, t - offset );
> }
> else
> {
>      offset = 25;
>      GfxSetTextColor( colorRed );
>      GfxTextOut( BarSinceCrossDown, x5, t - offset );
> }
> 
> GfxSelectFont( "Arial", 9, 700 );
> GfxSetTextColor( colorWhite );
> 
> Bar = "Bar";
> x4 = 78;
> 
> GfxTextOut( Bar, x4, t - offset ) ;
> 
> 
> Mike
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Mohammed" <softnews2003@> wrote:
> >
> > Hi Mike,
> >
> > I try the code you provide here, But I'm not able to add it as part of
> my other code.
> >
> > Can u help please.
> >
> > Thanks an advince
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Mohammed" softnews2003@ wrote:
> > >
> > > Hi Mike,
> > >
> > > I appreciated your reply. I will try that.
> > >
> > >
> > > Thanks again.
> > > Regards
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> > > >
> > > > Try something like the following (untested)
> > > >
> > > > if (LastValue(BarsSinceCrossedGreen) <
> LastValue(BarsSinceCrossedRed)) {
> > > > // Last cross ever was up
> > > > } else {
> > > > // Last cross ever was down
> > > > }
> > > >
> > > > Or possibly
> > > >
> > > > if (SelectedValue(BarsSinceCrossedGreen) <
> SelectedValue(BarsSinceCrossedRed)) {
> > > > // Last cross up to selection was up
> > > > } else {
> > > > // Last cross up to selection was down
> > > > }
> > > >
> > > > Mike
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Mohammed" <softnews2003@>
> wrote:
> > > > >
> > > > >
> > > > > Hi all,
> > > > >
> > > > > For the following code I'm using two values to show the number
> of bars
> > > > > since MACD cross. One value for up and one for down. These
> values
> > > > > showing both in the chart page, I would like to show only the
> last
> > > > > values depending to cross if the cross up I need to show the
> values for
> > > > > up and if it for down cross I need to show the value for down
> only.
> > > > > Instead of showing both values.
> > > > >
> > > > > One_Houre_Green_Cross = Cross(MACD(), Signal());
> > > > > One_Houre_Red_Cross = Cross(Signal(), MACD());
> > > > > BarSinceCrossgreen = BarsSince( One_Houre_Green_Cross);
> > > > > BarSinceCrossred = BarsSince( One_Houre_Red_Cross);
> > > > > BarSinceCrossUp = StrFormat(" %g ", BarSinceCrossgreen,
> SelectedValue(
> > > > > ROC( C, 1 ) ) );
> > > > > BarSinceCrossDown = StrFormat(" %g ", BarSinceCrossred,
> SelectedValue(
> > > > > ROC( C, 1 ) ) );
> > > > >
> > > > > GfxSelectFont( "Arial", 12, 700 );
> > > > > GfxSetBkMode( 1 );
> > > > > GfxSetTextColor( colorGreen);
> > > > > pxHeight = Status( "pxchartheight" );
> > > > > t = pxHeight;
> > > > > x5 = 101;
> > > > >
> > > > > GfxTextOut( BarSinceCrossUp, x5, t -50);
> > > > > GfxSetTextColor( colorRed);
> > > > > GfxTextOut( BarSinceCrossDown, x5, t -25);
> > > > > GfxSelectFont( "Arial", 9, 700 );
> > > > > GfxSetTextColor( colorBlack);
> > > > >
> > > > > Bar = "Bar";
> > > > > x4 = 78;
> > > > >
> > > > > GfxTextOut( Bar, x4, t -50) ;
> > > > > GfxTextOut( Bar, x4, t -25) ;
> > > > >
> > > > > Any one can help please.
> > > > > Regards
> > > > >
> > > >
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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