log in     sign up for free
 
If you can't take a small loss, sooner or later you will take the mother of all losses.
Ed Seykota
 
 
Home
systems (285)
 
 
Special offer: buy MetaStock (try for free)   |   Reuters QuoteCenter Real-Time Data (get a free month)   |   EOD Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

B % oscillator system

System for: MetaTrader

 

 

Views:  595

Added: November 16, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 
 

email this link

 
 
Tags: MetaTrader, system
 


% b oscillator system

 

 



Code:

/*[[
Name := % b
Author := Copyright © 2005, Lynndal Daniels, Nick Bilak
Link :=
Notes :=
Lots := 1
Stop Loss := 120
Take Profit := 800
Trailing Stop := 0
]]*/
Defines: mprd(200),bprd(5),bdev(1),bdays(3),bhi(0.8),blo(0.2),rule4(1),slippage(7),risk(10),mm(0);
var: i(0),buysig(false),sellsig(false),buyaddsig(false),selladdsig(false),exitlong(false),exitshort(false);
var: lotsi(0),orders(0);
Arrays: pb[5](0);

If Bars<1 or TakeProfit<10 then Exit;
If FreeMargin<200 then Exit;
If((CurTime-LastTradeTime)<10) then Exit;

if mm<>0 then
lotsi=Ceil(Balance*risk/10000)/10
else
lotsi=lots;

orders=0;
For i=1 to TotalTrades {
If Ord(i,Val_Symbol)=Symbol then {
orders++;
};
};
//get %b
//%b is defined as: %b= (Close - Lower Bollinger Band)/(Upper Bollinger Band - Lower Bollinger Band)
for i=1 to 4 {
pb[i]=(C[i]-iBandsEx(bprd,bdev,0,PRICE_CLOSE,MODE_LOW,i))/(iBandsEx(bprd,bdev,0,PRICE_CLOSE,MODE_HIGH,i)-iBandsEx(bprd,bdev,0,PRICE_CLOSE,MODE_LOW,i));
};
/*
Rules for Long Entries:

1.) The market closes above its 200-day moving average. (SMA)
2.) The %b closes below 0.2 for 3 days in a row.
3.) Buy the market at the close (or at the next opening) when rules 1 & 2 are met
4.) Buy an additional unit if/when %b closes below 0.2 for 4 days in a row (1 additional day)
5.) Exit at the close when %b closes above 0.8

Rules for Shorts:

1.) The market closes below its 200 day MA
2.) The %b closes above 0.8 for 3 days in a row
3.) Sell the market at close (or at the next opening) when rules 1 & 2 are met
4.) Sell an additional unit if/when %b closes above 0.8 for 4 days in a row (1 additional day)
5.) Exit at the close when %b closes below 0.2
*/

if c[1]>iMA(mprd,MODE_SMA,1) and pb[1] //if c[2]<=iMA(mprd,MODE_SMA,2) and c[1]>iMA(mprd,MODE_SMA,1) and pb[1] buysig=true;
exitlong=false;
if rule4=1 and orders=1 and pb[4] };
if c[1]bhi and pb[2]>bhi and pb[3]>bhi then {
//if c[2]>=iMA(mprd,MODE_SMA,2) and c[1]bhi and pb[2]>bhi and pb[3]>bhi then {
sellsig=true;
exitshort=false;
if rule4=1 and orders=1 and pb[4]>bhi then selladdsig=true;
};
if pb[1]>bhi then exitlong=true;
if pb[1]
if orders>0 then {
for i=1 to TotalTrades {
if ord(i,VAL_SYMBOL)=Symbol and ord(i,VAL_TYPE)=OP_SELL and exitshort then {
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),ord(i,VAL_CLOSEPRICE),slippage,white);
exit;
};
if ord(i,VAL_SYMBOL)=Symbol and ord(i,VAL_TYPE)=OP_BUY and exitlong then {
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),ord(i,VAL_CLOSEPRICE),slippage,white);
exit;
};
};
};

if orders=0 and buysig then {
buysig=false;
SetOrder(OP_BUY,lotsi,ask,Slippage,ask-StopLoss*point,ask+TakeProfit*point,blue);
exit;
};
if orders=0 and sellsig then {
sellsig=false;
SetOrder(OP_SELL,lotsi,bid,Slippage,bid+StopLoss*point,bid-TakeProfit*point,red);
exit;
};
if buyaddsig then {
buyaddsig=false;
SetOrder(OP_BUY,lotsi,ask,Slippage,ask-StopLoss*point,ask+TakeProfit*point,blue);
exit;
};
if selladdsig then {
selladdsig=false;
SetOrder(OP_SELL,lotsi,bid,Slippage,bid+StopLoss*point,bid-TakeProfit*point,red);
exit;
};

 




 

Code to difficult? Find somebody to help you with coding here.

 



Author: Lynndal Daniels, Nick Bilak
Source: www.xeatrade.com

 

View similar:

ASC Trend ++ Expert(v.2.1)
B % oscillator system
Awesome Oscillator auto Trader
Bolliger Breakout Ver 1.0
2ways system
5min USDCHF
2EMA system
2EMA System-v03
Always In Play
...
 
 
all systems for MetaTrader
all systems

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
PayPalSecure payments by PayPal S4T™ is a part of TAURO EDUCATION NETWORK
 
Privacy note | (c) copyrights systems4trading.com 2006-2009