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

[amibroker] Re: Need help with code for Multi Timeframe Ribbon on chart



PureBytes Links

Trading Reference Links

Hello, Reinsley:

Thank you for your response.  I have had this code for quite some time, and this is exactly what I've been trying to convert to range bars.  :)

Below, I've posted the sections that I believe are giving me a problem.  I only used the example in my first post because I thought it would be easier.....and shorter.

Following are the sections I think are giving me a problem because it doesn't look right on the chart....  I think my problem is understanding where to place the TimeFrameMode(4) and what to put after TimeframeSet.  I am using range bars..ranges 375 default, Min=50, Max=500, Step increment = 1.

I would appreciate if someone could tell what I am doing wrong. 

Thank you,

Evelyn

 

_SECTION_BEGIN("DynamicSR");

 

iPeriods = Param("Num Lookback Bars",5 ,1, 100,1);

tfSR = Param("SR TimeFrame (min)",5,1,240,1);  

 

   change to:

(leave iPeriods the same???) 

tfSR = Param("SR TimeFrame rbint)",375,50,500,1);

 

 

// Calculate Dynamic SR in the user specified timeframe

iSRtimeframe = tfSR * 60;

TimeFrameSet(iSRtimeframe);

 

    change to:

 

iSRtimeframe = tfsr;

 

_SECTION_BEGIN("SlotMachine");

 

if(bPlotSM) {

   Row3Minutes = Param("Row3 TimeFrame (min)",60,1,240,1);

   Row3Time = Row3Minutes * 60;

   Row2Time = iSRtimeframe;

 

  change to:

 

if(bPlotSM) {

   Row3rangebar = Param("Row3 Rbint)",375,50,500,1);

   Rbint = Row3rangebar;

   Row2Time = iSRtimeframe;

 

 

   TimeFrameSet(Row2Time);

   btfRow2 = Ref(C,-1) > Ref(O,-1);

   TimeFrameRestore();

 

         change to:

 

   TimeFrameMode(4);

   TimeFrameSet( Param("Row3 Rbint)",375,50,500,1));

   btfRow2 = Ref(C,-1) > Ref(O,-1);

   TimeFrameRestore();

 

 

   TimeFrameSet(Row3Time);

   btfRow3 = C > O;

   TimeFrameRestore();

 

     change to:

 

   TimeFrameMode(4);

   TimeFrameSet(Param("Row3 Rbint)",375,50,500,1));

   btfRow3 = C > O;

   TimeFrameRestore();

 

 

And this would stay the same??

 

   bRow2 = TimeFrameExpand(btfRow2, Row2Time);

   bRow3 = TimeFrameExpand(btfRow3, Row3Time);


--- In amibroker@xxxxxxxxxxxxxxx, reinsley <reinsley@xxx> wrote:
>
> Hello,
>
> The dynamic support-resistance formule could be useful to plot
> multi-timeframe ribbons...
>
> http://codefortraders.com/phpBB3/viewtopic.php?f=60&t=107&sid=bb6a3e5165f0edf18ecbf93d91c5944d
>
>
> Best regards
>
> Evelyn Broom a écrit :
> >
> > I have written to support on 4 different occasions over the past 3
> > months and have never received a reply, so I thought I would try this
> > forum. I hope someone can help me. It seems to be a simple matter
> > for someone who understands how to code in afl....so perhaps a lot of
> > people who have seen my posts at other forums are rolling on the floor
> > laughing themselves to tears, while I am in tears for the opposite
> > reason. :-(
> >
> > I am trying to create a multi-timeframe ribbon at the bottom of my
> > charts using range bars rather than "time or minute" bars. I have
> > made several attempts on my own. I used the "minute" timeframe, and
> > it still does not work and I "borrowed" this code from a few different
> > posts. (Believe it or not, I have even read the 300+ page manual!)
> > The explanation in the manual and tutorial are not clear to me on how
> > to code using range bars, and I have not found anything on any forum
> > regarding how to code with them.
> >
> > Can someone please tell me what I am doing wrong? And, how can I
> > convert this to RANGE BARS? (Specifically, 375, 125 and 50 range
> > bars.) The strategy I plan to use is much more detailed than this,
> > but I am using this one as an example of what I am trying to
> > accomplish because it is a much shorter example.
> >
> > I would really appreciate if someone knows how to do this and is
> > willing to share.
> >
> > Thank you,
> >
> > Evelyn..............following is the code.....
> >
> > #pragma nocache
> >
> > blankRightBars = 5; //insert actual blank right bars specified in
> > Preferences
> >
> > barsInView = Status("lastvisiblebarindex") -
> > Status("firstvisiblebarindex") - blankRightBars;
> >
> > Offset = Param("Offset Bar", 0.95, 0, 1, 0.01);
> >
> > textOffset = *BarCount* - (Offset * barsInView);
> >
> >
> >
> > TimeFrameSet(*in1Minute**30);
> >
> > MA5_30 = MA(*C*,5);
> >
> > MA8_30 = MA(*C*,8);
> >
> > MA14_30 = MA(*C*,14);
> >
> > Color= IIf(MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > (MA(*C*,14)),
> > *colorGreen*,6);
> >
> > Plot(20,"",Color,*styleHistogram*+*styleThick*|*styleArea*|*styleNoLabel*,0,100);
> >
> > Plot(21,"",*colorBlack*,*styleOwnScale*|*styleArea*|*styleNoLabel*,0,100);
> >
> > PlotText("Heinkein 4T tf:"+Interval(2), textoffset, 61.95,*colorYellow*);
> >
> > printf("\n = " +WriteVal(*Close*));
> >
> > CondB= MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > MA(*C*,14);
> >
> > Conds = *Close* < MA(*C*,5);
> >
> > TimeFrameRestore();
> >
> >
> >
> > TimeFrameSet(*in1Minute**5);
> >
> > MA5_30 = MA(*C*,5);
> >
> > MA8_30 = MA(*C*,8);
> >
> > MA14_30 = MA(*C*,14);
> >
> > Color= IIf(MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > (MA(*C*,14)),
> > *colorGreen*,6);
> >
> > Plot(20,"",Color,*styleHistogram*+*styleThick*|*styleArea*|*styleNoLabel*,0,100);
> >
> > Plot(21,"",*colorBlack*,*styleOwnScale*|*styleArea*|*styleNoLabel*,0,100);
> >
> > PlotText("Heinkein 4T tf:"+Interval(2), textoffset, 61.95,*colorYellow*);
> >
> > printf("\n = " +WriteVal(*Close*));
> >
> > CondB1= MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > MA(*C*,14);
> >
> > Conds1 = *Close* < MA(*C*,5);
> >
> > TimeFrameRestore();
> >
> >
> >
> > TimeFrameSet(*in1Minute*);
> >
> > MA5_30 = MA(*C*,5);
> >
> > MA8_30 = MA(*C*,8);
> >
> > MA14_30 = MA(*C*,14);
> >
> > Color= IIf(MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > (MA(*C*,14)),
> > *colorGreen*,6);
> >
> > Plot(20,"",Color,*styleHistogram*+*styleThick*|*styleArea*|*styleNoLabel*,0,100);
> >
> > Plot(21,"",*colorBlack*,*styleOwnScale*|*styleArea*|*styleNoLabel*,0,100);
> >
> > PlotText("Heinkein 4T tf:"+Interval(2), textoffset, 61.95,*colorYellow*);
> >
> > printf("\n = " +WriteVal(*Close*));
> >
> > CondB2= MA(*C*,5) > MA(*C*,8) *AND* MA(*C*,8) > MA(*C*,14);
> >
> > Conds2 = *Close* < MA(*C*,5);
> >
> > TimeFrameRestore();
> >
> >
> >
> > *Buy*= CondB *AND* CondB1 *AND* CondB2;
> >
> > **
> >
> > *Sell*=CondS *AND* CondS1 *AND* CondS2;
> >
> > **
> >
> > *Buy*=ExRem(*Buy*,*Sell*);
> >
> > **
> >
> > *Sell*=ExRem(*Sell*,*Buy*);
> >
> > PlotShapes(*shapeSmallCircle***Buy*, *colorGreen*,0,62.70);
> >
> > PlotShapes(*shapeSmallCircle***Sell*, *colorRed*,0,62.70);
> >
> >
>

__._,_.___

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

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

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

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___