BuyZone indicator for Amibroker

Moderator: moderators

User avatar
dbw451
rank: 50+ posts
rank: 50+ posts
Posts: 50
Joined: Sun Jul 22, 2007 9:45 pm
Reputation: 0
Gender: Male

Postby dbw451 » Wed Aug 15, 2007 7:04 pm

Vino,

An order entry system is dependant on your broker. Ninja is very good and works with many different brokers. Some brokers offer monthly rebates to cover the cost of Ninja.

You should take a look at your broker's order interface features. I've found that TradeStation's Matrix and Interactive Brokers' Book Trader to be more than sufficient for automatically entering OCA bracket orders with multiple exits. Best of all, their usage is free.

Regards,

David

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

alichambers
rank: 50+ posts
rank: 50+ posts
Posts: 79
Joined: Wed Nov 08, 2006 4:46 pm
Reputation: 0
Gender: Male

Postby alichambers » Tue Sep 18, 2007 7:45 pm

Wow - I went away and this thread has gone forth and multiplied!

Thanks to everyone adding their bit in.

Alex

paras
rank: <50 posts
rank: <50 posts
Posts: 3
Joined: Thu Sep 27, 2007 7:23 am
Reputation: 0
Location: ind
Gender: Male
Contact:

Postby paras » Fri Sep 28, 2007 8:21 am

dbw451 wrote:
I noticed that QuickAFL was playing havoc on the time expanded dynamic SR dots, so I added the dreaded SetBarsRequired to the code. This slows down the display significantly so if you use the indicators in real-time, I would set your chart timeframe to the same timeframe as the dynamic SRs (e.g. 5 minutes is the default).

I also parameterized many of the indicator colors so that I could print out some charts and write on them. The black chart background works best for me on my monitor, but is terrible for print outs. The picture above is a snapshot of a screen that I could print. Resetting back to the default colors can easily be done by pressing the Reset All button on the parameter window.

Regards,

David


hello sir ,
nice coded ans very interesting and useful indicator .as i am new to amibroker coding ....i request u please plot buy -sell arrows or pls guide me how to plot buy -sell arrows as this will help in exploring\scanning the data base.. please do this need ful ....thanking you and pls keep this type of work going on...

User avatar
dbw451
rank: 50+ posts
rank: 50+ posts
Posts: 50
Joined: Sun Jul 22, 2007 9:45 pm
Reputation: 0
Gender: Male

Postby dbw451 » Sat Sep 29, 2007 2:05 am

The actual plotting of Buy and Sell arrows is simple, however you need to decide on your buying and selling logic. Here's some example code that I played with a while back, but you'll need to include it in the TRO indicator code and modify it to work the way you want it to:

bBuy = Ref(bDynamic_S,-1); // Previous bar low is at dynamic support
bBuy = bBuy AND (Ref(Low,-2) > Ref(Dynamic_S,-2)); // Make sure low is still above support
bBuy = bBuy AND (Ref(High,-1) >= Ref(tfHigh,-1)); // Make sure previous bar hits trigger price of high of DSR bar
bBuy = bBuy AND Low < EntryL; // Make sure the low goes below open to ensure limit order at open is filled

bShort = Ref(bDynamic_R,-1); // Previous bar high is at dynamic resistance
bShort = bShort AND (Ref(High,-2) < Ref(Dynamic_R,-2)); // Make sure high is still below resistance
bShort = bShort AND (Ref(Low,-1) <= Ref(tfLow,-1)); // Make sure previous bar hits trigger price of high of DSR bar
bShort = bShort AND High > EntryS; // Make sure the high goes above the open to ensure limit order at open is filled

PlotShapes( shapeUpArrow*bBuy, colorGreen,0, L, -20);
PlotShapes( shapeDownArrow*bShort, colorRed,0,H, -20);

Regards,

David
TRADE THE MARKET, NOT THE INDICATORS

http://nickajackcreektradingco.com
Support & Resistance Day Trading

paras
rank: <50 posts
rank: <50 posts
Posts: 3
Joined: Thu Sep 27, 2007 7:23 am
Reputation: 0
Location: ind
Gender: Male
Contact:

THANK YOU SIR

Postby paras » Sat Sep 29, 2007 3:36 pm

dbw451 wrote:The actual plotting of Buy and Sell arrows is simple, however you need to decide on your buying and selling logic. Here's some example code that I played with a while back, but you'll need to include it in the TRO indicator code and modify it to work the way you want it to:

bBuy = Ref(bDynamic_S,-1); // Previous bar low is at dynamic support
bBuy = bBuy AND (Ref(Low,-2) > Ref(Dynamic_S,-2)); // Make sure low is still above support
bBuy = bBuy AND (Ref(High,-1) >= Ref(tfHigh,-1)); // Make sure previous bar hits trigger price of high of DSR bar
bBuy = bBuy AND Low <[glow=red] EntryL;[/glow] // Make sure the low goes below open to ensure limit order at open is filled

bShort = Ref(bDynamic_R,-1); // Previous bar high is at dynamic resistance
bShort = bShort AND (Ref(High,-2) < Ref(Dynamic_R,-2)); // Make sure high is still below resistance
bShort = bShort AND (Ref(Low,-1) <= Ref(tfLow,-1)); // Make sure previous bar hits trigger price of high of DSR bar
bShort = bShort AND High > [glow=red]EntryS;[/glow] // Make sure the high goes above the open to ensure limit order at open is filled

PlotShapes( shapeUpArrow*bBuy, colorGreen,0, L, -20);
PlotShapes( shapeDownArrow*bShort, colorRed,0,H, -20);

Regards,

David

DEAR SIR ,
THANK YOU VERY MUCH FOR YOUR QUICK REPLY...
ONE MORE THING I CANT USE YOUR 4th BUR-SELL CONDITION [ ENTRY L @ ENTRYS ] WHAT SHOULD BE ENTRYL@ENTRYS .......AND ANOTHER THING ..BUYZONE IS PLOTTED ON 5 MIN CHART ONLY ..CAN IT BE CHANGED ACCORDING TO OUR CHART TIME FRAME I.E IT MUST BE PLOTTED ON EVERY TIME FRAME 5-8-10-12 MIN ETC ....ACCORDING TO OUR CHART TIME FRAME
THANKING U SO MUCH AND I HOPE I DIDNT ASKED U TOO MUCH ...KINDLY DO THIS LAST NEEDFUL THING .......THANKING U IN ANTICIPATION HAVE A NICE TIME
btw iam using amibroker v 5 [ licenced]

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
dbw451
rank: 50+ posts
rank: 50+ posts
Posts: 50
Joined: Sun Jul 22, 2007 9:45 pm
Reputation: 0
Gender: Male

Postby dbw451 » Sat Sep 29, 2007 5:20 pm

The Buy and Sell arrow code was meant to be EXAMPLE logic of how to code the arrows, not logic to actually use. However, becaue I posted the EntryL and EntryS variables, here's some additional example code which may or may not be the way you'll want to trigger trades for the Dynamic SRs:

pctEntry = Param("pctEntry",0.23,0.05,0.75,0.05);

EntryL = Min(Open, int((pctEntry * DynamicRange) + Dynamic_S + 0.49));
EntryS = Max(int(Dynamic_R - (pctEntry * DynamicRange) - 0.49), Open);
EntryL = Min(Open, int(fib1 - 0.49));
EntryS = Max(int(fib5 + 0.49), Open);

The 5 minute time frame refers to the Dynamic Support & Resistance logic, not the BuyZone logic. You can make the change by parameterizing the two constants with the following code:

PeriodToUse = Param("Period",5,1,100,1);
iSRtimeframe = PeriodToUse * 60;

Regards,

David
TRADE THE MARKET, NOT THE INDICATORS



http://nickajackcreektradingco.com

Support & Resistance Day Trading

paras
rank: <50 posts
rank: <50 posts
Posts: 3
Joined: Thu Sep 27, 2007 7:23 am
Reputation: 0
Location: ind
Gender: Male
Contact:

Postby paras » Sun Sep 30, 2007 4:51 am

dbw451 wrote:The Buy and Sell arrow code was meant to be EXAMPLE logic of how to code the arrows, not logic to actually use. However, becaue I posted the EntryL and EntryS variables, here's some additional example code which may or may not be the way you'll want to trigger trades for the Dynamic SRs:

pctEntry = Param("pctEntry",0.23,0.05,0.75,0.05);

EntryL = Min(Open, int((pctEntry * DynamicRange) + Dynamic_S + 0.49));
EntryS = Max(int(Dynamic_R - (pctEntry * DynamicRange) - 0.49), Open);
EntryL = Min(Open, int(fib1 - 0.49));
EntryS = Max(int(fib5 + 0.49), Open);

The 5 minute time frame refers to the Dynamic Support & Resistance logic, not the BuyZone logic. You can make the change by parameterizing the two constants with the following code:

PeriodToUse = Param("Period",5,1,100,1);
iSRtimeframe = PeriodToUse * 60;

Regards,

David


THANK YOU SIR FOR THE ENTRYL-ENTRYC CODE & EXPLAINATION ,
I AM REALLY GREATFUL TO U .....GOD BLESS U :D

brevco
rank: <50 posts
rank: <50 posts
Posts: 1
Joined: Sun Jun 22, 2008 4:09 am
Reputation: 0
Location: Colorado
Gender: Female

Slot Machine and timezones

Postby brevco » Sun Jun 22, 2008 4:55 pm

Hello,

I am new to this forum, but I have owned Amibroker for about 5 years. Fortunately, I found this forum.

If someone could help me, I would sincerely appreciate it. I am learning afl code, but there are some things I have not been able to figure out on my own....and Amibroker support has not responded (yet) after two inquiries over a month's time.

I use range bars to trade futures. Is it possible to convert the timeframe from minutes to range bars in the Slot Machine indicator? How can I do that?

Believe it or not, I have coded something similar to these ribbons, but it was not nearly as detailed. The coding for the slot machine ribbons is absolutely amazing! I've spent many hours trying to attempt this.....and it has been here all along. Thank you! I did not realize I was trying to recreate the wheel.

Thank you in advance for your assistance/support with this timeframe conversion.

Following is the code I would like to convert to range bars if it is possible: (I am using 1.55, .85 and .45 range bar periods, but the total ranges are from 3.0 down to .45, depending on the futures contract I am trading.)

_SECTION_BEGIN("SlotMachine");

if(bPlotSM) {
Row2Minutes = Param("Row2 TimeFrame (min)",5,1,240,1);
Row3Minutes = Param("Row3 TimeFrame (min)",60,1,240,1);
Row2Time = Row2Minutes * 60;
Row3Time = Row3Minutes * 60;

TimeFrameSet(Row2Time);
btfRow2 = C > O;
TimeFrameRestore();

TimeFrameSet(Row3Time);
btfRow3 = C > O;
TimeFrameRestore();

bRow2 = TimeFrameExpand(btfRow2, Row2Time);
bRow3 = TimeFrameExpand(btfRow3, Row3Time);

bTrendTrigger = IIf((bDynamic_R AND (!bRow2 OR !bRow3)), 1, IIf((bDynamic_S AND (bRow2 OR bRow3)), 1, 0));

Plot( 1, "Day", IIf( C > bzOpen, colorGreen, colorDarkRed), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
Plot( 2, "60min", IIf( bRow3, colorBrightGreen, colorRed), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
Plot( 3, "5min", IIf( bRow2, colorGreen, colorDarkRed), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
Plot( 4, "Trigger", IIf((bTrendTrigger AND bDynamic_S), colorBlue, IIf((bTrendTrigger AND bDynamic_R), colorRed, colorBlack)), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
}

_SECTION_END();

options2001
rank: <50 posts
rank: <50 posts
Posts: 1
Joined: Fri Nov 21, 2008 10:59 pm
Reputation: 0
Gender: None specified

Re: Dynamic SR multi-timeframe

Postby options2001 » Fri Nov 21, 2008 11:12 pm

dbw451 wrote:I updated the Dynamic SR code to allow a user specified timeframe for the Dynamic SR and Fibs instead of using the chart timeframe. This allows displaying chart timeframes smaller than the Dynamic SR timeframe. For example, the 1 minute YM chart below (Chart 1) shows a 5 minute Dynamic SR. Every 5 price bars is a single Dynamic SR bar, thus 5 SR dots are displayed for each Dynamic SR value. This allows you to drill down inside a Dynamic SR bar and see how price moved within the bar (assuming you have the more detailed data).

Chart 1


I also added a line plot of the high and low of the Dynamic SR price bars. This makes it easier to see how the price chart timeframe bars move within the Dynamic SR timeframe bars. This can be turned on/off and is shown in the Chart 2 below.

Chart 2



Attached is the AmiBroker code. I hope someone finds it useful.

Regards,

David




Does anyone have the code for these charts. I cant find the attachment with the code for the above charts. Any help is appreciated thanks

malik33
rank: <50 posts
rank: <50 posts
Posts: 1
Joined: Fri Mar 19, 2010 12:12 pm
Reputation: 0
Location: DELHI
Gender: None specified

HELP ( ANY ONE CORRECT THIS AFL FOR ALL FRIENDS)

Postby malik33 » Fri Apr 23, 2010 11:14 am

HELLO EVERYONE

AFL RESULT 1I 98% SURE.
Attachments
develop this indicater.doc
PLS CORRECT THIS AFL FOR AMIBROKER
(41.5 KiB) Downloaded 656 times

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “AmiBroker”