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 » Sat Aug 11, 2007 3:38 pm

When trading in dynamic real-time markets, the timing of bar closes rarely reflect the 'best' place for a trade entry. However, if you are trading a strategy based on chart bars, then it is best to wait until the bar close that completes whatever pattern you are trading.

I went through a period in my trading life where I would jump as soon as a signal appeared. Many times the signal would disappear before the signal bar closed. When I would review my trades at the end of the day, those trade entries would look just plain stupid because the strategy signals did not exist on my charts. Developing the discipline to wait for a signal to fully develop (and stay on my historical charts) helped my trading immensely.

A trade setup and entry timing are two separate things. A trade setup gives you a trade signal. You then decide how and where you want to enter. It's simpliest to select a price based on a bar (like the current bar's opening price or the previous bar's closing price or a tick above/below a bar's high/low). If the trade setup is high probability, the setup with a simple entry technique works well.

Regards,

David

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

User avatar
Patch
rank: 500+ posts
rank: 500+ posts
Posts: 941
Joined: Sat Jan 06, 2007 6:13 pm
Reputation: 0
Location: Virginia
Real name: Jeff
Gender: Male
Contact:

Postby Patch » Mon Aug 13, 2007 12:44 pm

Hey David

I couldn't agree more with your post. Absolutely true. My naturual tendency is to run away with myself.

Patch the Pirate
In the Pirate Cove in VA

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 » Mon Aug 13, 2007 7:12 pm

Yeah, I think most traders have similar tendencies. The desire to make money gets us into trades before signals complete. Also, the natural tendency to want to fight back when things are not going our way leads to over-trading and taking on too much risk.

Regards,

David

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

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

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 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

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

ahmedalhoseny
rank: 50+ posts
rank: 50+ posts
Posts: 111
Joined: Sat Dec 31, 2011 7:28 pm
Reputation: 0
Gender: Male
Contact:

Postby ahmedalhoseny » Tue Oct 23, 2012 7:33 pm

hello

any chance to have Mighty zone & II_SupDem in AFL code

Thanks in advance

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


Return to “AmiBroker”