Thread: Raw Ideas
View Single Post
  #12 (permalink)  
Old 11-16-2005, 04:41 PM
fab4x fab4x is offline
Junior Member
 
Join Date: Oct 2005
Posts: 13
fab4x is on a distinguished road
Thumbs up Bartrader

I have this EA for MT3 and its simple design is to place 2 orders BUYSTOP and SELLSTOP.
Now its price is calculated from the previous bar info. The pivot value is generated and then add +17 for BUY and -13 for sell off that pivot value. If trade is executed then it should close at end of bar. If not then both are deleted at end of bar. Then it does the whole thing again.
I would use a breakeven to 0 after 10pips

Could someone take a look at this EA to make some changes to do this.



/*[[
Name := BARTRADER
Author := FAB4X
Link := http://www.FAB4X.com
Notes := Use on 15 or 30m charts
Lots := 1.00
Stop Loss := 45
Take Profit := 25
Trailing Stop := 0
]]*/


define: Slippage(5);
define: MM(0);
define: Risk(7.5);

var: cnt(0);
var: Opentrades(0);
var: lotsi(0);
var: trend("");
var: vTime(0);
var: vol1(0);
var: vol2(0);
var: myh(0),myl(0),myc(0),pivot(0),buyprice(0),sellpric e(0);
//////////////////////////////////////////////////
// Exit if not H4 charts
//////////////////////////////////////////////////
/*
if Period != 240 then
{
Comment("This expert is for 4HR Charts");
Exit;
}
*/
//////////////////////////////////////////////////
// Exit if time between EA runs is less than 5 sec.
//////////////////////////////////////////////////
if Curtime - LastTradeTime < 5 then exit;

//////////////////////////////////////////////////
// Set if back tester earlier than 2005
//////////////////////////////////////////////////
If TimeYear(time)<2005 then Exit;

//////////////////////////////////////////////////
// Set Variables
//////////////////////////////////////////////////
Slippage = Slippage*Point;
myh=High[1];
myl=Low[1];
myC=Close[1];

Pivot = ( myh+myl+myc )/ 3 ;
buyprice=pivot+17*point;
sellprice=pivot-13*point;

//////////////////////////////////////////////////
// Set Comment
//////////////////////////////////////////////////


//////////////////////////////////////////////////
///////////// Manage multiple trades /////////////
//////////////////////////////////////////////////
Opentrades = 0;
for cnt = 1 to TotalTrades
{
If OrderValue(cnt,Val_Symbol) == Symbol then
{
Opentrades++;
}
};

//////////////////////////////////////////////////
///////////// Money Manager /////////////
//////////////////////////////////////////////////
if mm != 0 then Lotsi = Ceil(Balance*risk/10000)/10
else Lotsi=Lots;

//////////////////////////////////////////////////
// Close Order after each bar!
//////////////////////////////////////////////////
if Opentrades != 0 and vTime != Time[0] then
{
for cnt=1 to TotalTrades
{
If Ord(cnt,VAL_SYMBOL) == Symbol then
{
If (Ord(cnt,VAL_TYPE)=OP_BUY or Ord(cnt,VAL_TYPE)=OP_SELL) then
{
vTime = Time[0];
CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_ LOTS),(cnt,VAL_CLOSEPRICE),Slippage,BlueViolet);
// Exit;
}
If (Ord(cnt,VAL_TYPE)=OP_BUYSTOP or Ord(cnt,VAL_TYPE)=OP_SELLSTOP) then
{
vTime = Time[0];
DeleteOrder(OrderValue(cnt,VAL_TICKET),Brown);
// Exit;
}

}

}
}
//////////////////////////////////////////////////
// Open Trade at start of bar!
//////////////////////////////////////////////////
if Opentrades == 0 and vTime != Time[0] then
{

vTime = Time[0];
SetOrder(OP_BUYSTOP,Lotsi,buyprice,Slippage,buypri ce-stoploss*point,buyprice+takeprofit*point,blue);
// Exit;
};
if Opentrades > 0 then
{
//vTime = Time[0];
SetOrder(OP_SELLSTOP,Lotsi,sellprice,Slippage,sell price+stoploss*point,sellprice-takeprofit*point,Red);
// Exit;
}



exit;
Reply With Quote