| |
 |
Bolliger Breakout Ver 1.0
|
 |
|
|
|
Views:
2520 |
| Added: November 16, 2008 |
| |
|
|
|
| This formula has not been rated yet |
| |
| |
email this link
|
| |
| |
| Tags:
MetaTrader, system
|
| |
 |
Code:
/*[[
Name := Bollinger Breakout
Author := Lior Nabat
Lots := 1.00
Stop Loss := 50
Take Profit := 90
Trailing Stop := 50
Update on every tick:= Yes
]]*/
/*
HI,
This Expert use 3 rules:
1. Breakout of Bollinger and reversal
2. Waiting for crossing the 62 EMA
3. Enough space between the 200 SMA ( that sometimes act as support and resistance
Use only in EUR/USD and USD and CHF 15 min, not optimize yet.
gives very good results,
you can increase the lots and gain more profit.
it will be great to get feedback on my Email:
lior6@netvision.net.il
lior,
BTW, currently the trailing stop is not working...
*/
vars: Slippage(2);
defines: EMA(62),ShortFlag(0),LongFlag(0);
vars: sl(0),tp(0),p(0),q(0),s(0),mode(0),HighBar(0),LowBar(0),OpenBar(0),CloseBar(0),Shift(0),cnt(0);
If Bars<100 or TakeProfit<10 then Exit;
If IsIndirect(Symbol)=TRUE then Exit;
p=1.0*iATR(3,1); //p=TrailingStop*Point;BUY
q=1.0*iATR(3,1); //q=TrailingStop*Point;
s=1.0*Point;
If CurTime-LastTradeTime>60 and TotalTrades<1
then
{
if open[Shift+1]close[Shift] then
if Close[shift+1]> iBANDS(21,2,MODE_HIGH,Shift+1) then
// Checking the breakout and the reversal
{
ShortFlag=1;
LongFlag=0;
}
if ShortFlag and bid<= iMA(EMA,MODE_EMA,shift) and (close[shift] - iMA(200,MODE_SMA,Shift) > (15*point))
then
{
SetOrder(OP_SELL,Lots,bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,Red);
Alert ("Sell Short at: ",Bid,"S/L:",Bid+StopLoss*Point,"T/P: ",Bid-TakeProfit*Point);
ShortFlag=0;
Exit;
};
// checking the cross ...
//LONG TRADES ENTRY CRITERIA
if open[Shift+1]>close[Shift+1] and open[Shift]
if Close[shift+1]
{
ShortFlag=0;
LongFlag=1;
}
if LongFlag and ask >= iMA(EMA,MODE_EMA,shift) and (iMA(200,MODE_SMA,Shift) - open[shift]> (15*point))
then
{
SetOrder(OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,Blue);
Alert ("Buy Long at: ",Ask,"S/L:",Ask-StopLoss*Point,"T/P: ",Ask+TakeProfit*Point);
LongFlag=0;
Exit;
};
};
if TrailingStop<5 then { print("Invalid trailing stop"); Exit; };
/* ????????? ????? ???????? ???????.
???????? ???? ???????? ????? ??????????? Stop Loss. */
for cnt=1 to TotalTrades
begin
/* ??? ??????? ???????? */
If Ord(cnt,VAL_TYPE)=OP_BUY then /* ??????? ??????? */
{
/* ??????? ???????? - ???? ?? ?????? ? ???? ?????? ?????? ???
??????? ???????? ?????? ????????? Bid, ??? ??? ??????? BUY */
If (Bid-Ord(cnt,VAL_OPENPRICE))>(TrailingStop*Point) then
{
/* ??, ??????? ????? ??????? ?????? ??? ???????? ???????? ?????
(???????? 30 ???????). ?????? ???? ?????????, ????? ??
????????? ???? ????? ??? ?? ??? ?????? */
If Ord(cnt,VAL_STOPLOSS)<(Bid-TrailingStop*Point) then
{
/* ?????? ???????? ?? ??????? Bid-Trailing Stop */
ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE),
Bid-TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red);
Exit; /* ???? ??????? - ???????. */
};
};
};
/* ??? ???????? ???????? */
If Ord(cnt,VAL_TYPE)=OP_SELL then
{
/* ??????? ???????? - ???? ?? ?????? ? ???? ?????? ?????? ???
??????? ???????? ?????? ????????? Ask, ??? ??? ??????? SELL */
If (Ord(cnt,VAL_OPENPRICE)-Ask)>(TrailingStop*Point) then
{
/* ??, ??????? ????? ??????? ?????? ??? ???????? ???????? ?????
(???????? 30 ???????). ?????? ???? ?????????, ????? ??
????????? ???? ????? ??? ?? ??? ?????? */
If Ord(cnt,VAL_STOPLOSS)>(Ask+TrailingStop*Point) or
Ord(cnt,VAL_STOPLOSS)=0 then /* ???????????? ???????!!! */
{
/* ?????? ???????? ?? ??????? Ask+Trailing Stop */
ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE),
Ask+TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red);
Exit;
};
};
};
end;
Code to difficult? Find somebody to help you with coding here.
Author: Lior Nabat
Source: www.xeatrade.com
all systems for MetaTrader
all systems
|