Google Search Result

ap.cobra thv 1.0  

Posted by Azrul in

Here code for Double Parabolic SAR EA. just copy and paste to your metaeditor and save. then run your metarader. but I never guarantee any results

//external variables

extern int Slippage =1;
extern string Ordercomment ="ap.cobra thv 1.0";
extern int MagicNumber =1776;
extern bool Use.Money.Mgt =true; // if false, uses Minimum.Lot
extern double Minimum.Lot =0.01; // Smallest lot size to trade, Use.MM true or false
extern double MaximumRisk =0.0025; // %account balance to risk per position

//internal variables
double tv, Lp2c, Sp2c;
int Bticket,Sticket,ordertype,slippage;
double spread,bprice,sprice,ssl,bsl,btp,stp,MaxDrawDown,MaxMargin,lot,Margin,Balance, slpoint;
datetime shorttime,longtime,expire;
color Color;bool result; string swap;
/*Avg.Price*/double buys, sells, bap, sap, blots, slots, Lswap, Sswap, LProfit, SProfit;
/*MAE*/double lmae,smae; int ot,ct;

string comment;
int init() {Avg.Price(); AccountExtremes(); MAE(); comments();return(0);}
int deinit(){return(0);}
int start() {
spread=Ask-Bid; Avg.Price(); AccountExtremes(); MAE(); comments();

//delete excess expert created objects
if(/*DayOfWeek()==1 && */Hour()==0 && Minute()<=1) {
for(int i=ObjectsTotal();i>=100;i--) {
if(StringSubstr(ObjectName(i),0,1)=="#") {
ObjectDelete(ObjectName(i)); } } }

double hull=iCustom(Symbol(),0,"hull THV",55,0.2,0,0);
double T3=iCustom(Symbol(),0,"T3 THV",8,0.04,0,0);
double hao=iCustom(Symbol(),0,"Heiken Ashi THV",CLR_NONE,CLR_NONE,MediumVioletRed,Green,0,0);
double hac=iCustom(Symbol(),0,"Heiken Ashi THV",CLR_NONE,CLR_NONE,MediumVioletRed,Green,1,0);
double haop=iCustom(Symbol(),0,"Heiken Ashi THV",CLR_NONE,CLR_NONE,MediumVioletRed,Green,0,1);
double hacp=iCustom(Symbol(),0,"Heiken Ashi THV",CLR_NONE,CLR_NONE,MediumVioletRed,Green,1,1);
double ia=iCustom(Symbol(),0,"Ichimoku THV",2,5,8,2,0);
double ib=iCustom(Symbol(),0,"Ichimoku THV",2,5,8,3,0);
double osma1=iCustom(Symbol(),0,"OsMA",12,26,7,0,0);
double osma2=iCustom(Symbol(),0,"OsMA",12,26,7,0,1);

//exit open positions?
for(int o=0; o
OrderSelect(o,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) {
if(OrderType()==1
OrderType()==3
OrderType()==5) { Sticket=OrderTicket(); }
if(OrderType()==0
OrderType()==2
OrderType()==4) { Bticket=OrderTicket(); }
if(OrderType()==1) {
if((haoosma2)

(Bid>T3)
(Bid>ia && Bid>ib) &&
shorttime
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Black);
shorttime=Time[1]; } }
if(OrderType()==0) {
if((hao>hac && osma1

(Ask
(Ask
longtime
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Black);
longtime=Time[1]; } } } }

//ORDER ENTRY SETUP 0-buy,2-buylimit,4-buystop
sprice=0;bprice=0;ssl=0;bsl=0;
if(OrderSelect(Sticket,SELECT_BY_TICKET)==false
(OrderSelect(Sticket,SELECT_BY_TICKET)==true && OrderCloseTime()>0)) {
if(Bid
ordertype=1; sprice=Bid; ssl=Ask+(50*Point);
stp=0; slippage=Slippage; expire=0;
Color=LightSalmon; Sell(); return(0); } }
if(OrderSelect(Bticket,SELECT_BY_TICKET)==false
(OrderSelect(Bticket,SELECT_BY_TICKET)==true && OrderCloseTime()>0)) {
if(Ask>T3/*hull && T3>hull && hac>hao && Ask>ia && Ask>ib*/ && longtime
ordertype=0; bprice=Ask; bsl=Bid-(50*Point);
btp=0; slippage=Slippage; expire=0;
Color=Green; Buy(); return(0); } }

return(0);}
//+------------------------------------------------------------------+
void AccountExtremes() {
//double MaxMargin, MaxDrawDown;
if(AccountMargin()>MaxMargin) MaxMargin=AccountMargin();
if(AccountProfit()
void Avg.Price() {//copy and paste variables to before init.
/*Avg.Price*///double buys, sells, bap, sap, blots, slots, Lswap, Sswap, LProfit, SProfit;
buys=0;blots=0;sells=0;slots=0;Lswap=0;Sswap=0;LProfit=0;SProfit=0;
for(int c=0; c
OrderSelect(c,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()) {
if(OrderType()==OP_BUY) {
buys+=(OrderOpenPrice()*OrderLots()); blots+=OrderLots();
Lswap+=OrderSwap(); LProfit+=OrderProfit(); }
if(OrderType()==OP_SELL) {
sells+=(OrderOpenPrice()*OrderLots()); slots+=OrderLots();
Sswap+=OrderSwap(); SProfit+=OrderProfit(); } } }

Pips2Cover();
if(buys>0) { bap=buys/blots; bap=NormalizeDouble(bap+Lp2c,Digits); }
if(buys<=0) { bap=0; buys=0; blots=0; Lp2c=0; }
if(sells>0) { sap=sells/slots; sap=NormalizeDouble(sap+Sp2c,Digits); }
if(sells<=0) { sap=0; sells=0; slots=0; Sp2c=0;}
if(ObjectFind("Average Buys")>-1) ObjectMove("Average Buys",0,Time[0],bap);
if(ObjectFind("Average Sells")>-1) ObjectMove("Average Sells",0,Time[0],sap);
if(bap==0) { ObjectDelete("Average Buys"); }
if(sap==0) { ObjectDelete("Average Sells");}
if(bap>0) {
ObjectCreate("Average Buys",1,0,Time[10],bap);
ObjectSetText("Average Buys","Average Buys");
ObjectSet("Average Buys",6,LimeGreen);
ObjectSet("Average Buys",7,STYLE_SOLID);
ObjectSet("Average Buys",8,1);
ObjectSet("Average Buys",9,true); }
if(sap>0) {
ObjectCreate("Average Sells",1,0,Time[10],sap);
ObjectSetText("Average Sells","Average Sells");
ObjectSet("Average Sells",6,LightSalmon);
ObjectSet("Average Sells",7,STYLE_SOLID);
ObjectSet("Average Sells",8,1);
ObjectSet("Average Sells",9,true); } } //end Average.Price

double Pips2Cover() {
//double tv, Lp2c, Sp2c;
tv=MarketInfo(Symbol(),16);
if(Lswap!=0) {
if(Lswap>0) {
Lp2c=-MathFloor(Lswap/(tv*blots))*Point; }
if(Lswap<0) {
Lp2c=MathFloor(Lswap/(tv*blots))*Point; } }
if(Sswap!=0) {
if(Sswap>0) {
Sp2c=-MathFloor(Sswap/(tv*slots))*Point; }
if(Sswap<0) {
Sp2c=MathFloor(Sswap/(tv*slots))*Point; } } }//end Pips2Cover()

void Buy() {//string Ordercomment; int MagicNumber, ticket; color Color;
/* if(lmae>0) {
bsl=NormalizeDouble( MathMax(bsl,bprice-(lmae*1.236)),Digits); }*/
Bticket=OrderSend(Symbol(),ordertype,LotsOptimized(),bprice,//Ask
slippage,
bsl,//no stoploss defined
btp,//no tp defined
Ordercomment,//comment
MagicNumber,
expire,//time expire,
Color);
if(Bticket>0) {
if(OrderSelect(Bticket,SELECT_BY_TICKET,MODE_TRADES)) {
longtime=Time[0]; Print(Bticket); }
else Print("Error Opening BuyStop Order: ",GetLastError());
return(0); } }//end Buy();

void Sell() {//string Ordercomment; int MagicNumber, ticket; color Color;
/* if(smae>0) {
ssl=NormalizeDouble( MathMin(ssl,sprice+(smae*1.236)),Digits); }*/
Sticket=OrderSend(Symbol(),ordertype,LotsOptimized(),sprice,//Bid
slippage,
ssl,//no stoploss set when stop order is executed
stp,//no tp defined

Ordercomment,
MagicNumber,
expire,//time expire,
Color);
if(Sticket>0) {
if(OrderSelect(Sticket,SELECT_BY_TICKET,MODE_TRADES)) {
shorttime=Time[0]; Print(Sticket); }
else Print("Error Opening SellStop Order: ",GetLastError());
return(0); } }//End Sell();

double LotsOptimized() {
double openprice, stoploss, risk;
Margin=MathMin( MathMin(AccountBalance(),AccountEquity() ) , AccountFreeMargin() );
if( (ordertype==0
ordertype==2
ordertype==4) && bprice-bsl>0) {
risk=(Margin*MaximumRisk)/((bprice-bsl)/Point); }
if( (ordertype==1
ordertype==3
ordertype==5) && ssl-sprice>0) {
risk=(Margin*MaximumRisk)/((ssl-sprice)/Point); }
lot=NormalizeDouble(risk,2);
if(lot
if(Use.Money.Mgt==false) {lot=Minimum.Lot;}
return(lot); }//end LotsOptimized

void comments() {
string day;
if(DayOfWeek()==0) day="Sunday ";
if(DayOfWeek()==1) day="Monday ";
if(DayOfWeek()==2) day="Tuesday ";
if(DayOfWeek()==3) day="Wednesday ";
if(DayOfWeek()==4) day="Thursday ";
if(DayOfWeek()==5) day="Friday ";

comment=StringConcatenate("Last Tick: ",day,TimeToStr(TimeCurrent(),TIME_DATE
TIME_SECONDS));
comment=comment+StringConcatenate("\nSwap Long ",MarketInfo(Symbol(),MODE_SWAPLONG));
comment=comment+StringConcatenate("\nSwap Short ",MarketInfo(Symbol(),MODE_SWAPSHORT));
comment=comment+StringConcatenate("\nAverage Longs: ",bap," B.Lots: ",blots);
comment=comment+StringConcatenate("\nAverage Shorts: ",sap," S.Lots: ",slots);
comment=comment+StringConcatenate("\nMargin*Risk: ",-Margin*MaximumRisk);
comment=comment+StringConcatenate("\nAccountProfit() ",AccountProfit());
comment=comment+StringConcatenate("\nMaxDrawDown ",MaxDrawDown);
comment=comment+StringConcatenate("\nAccountBalance() ",AccountBalance());
comment=comment+StringConcatenate("\nAccountEquity() ",AccountEquity());
comment=comment+StringConcatenate("\nAccountMargin() ",AccountMargin());
comment=comment+StringConcatenate("\nMaxMargin ",MaxMargin);
comment=comment+StringConcatenate("\nMax Adverse Excursion Longs: ",lmae," pips");
comment=comment+StringConcatenate("\nMax Adverse Excursion Shorts: ",smae," pips");
comment=comment+StringConcatenate("\nLProfit: $",LProfit," SProfit: $",SProfit);
comment=comment+StringConcatenate("\nSwap Longs $",Lswap," Swap Shorts $",Sswap);
Comment(comment);}//end comments()

void MAE() {
//lmae=0; smae=0;
for(int i=0; i
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if(Symbol()==OrderSymbol() && (OrderType()==0) && OrderProfit()>0) {
ot=iBarShift(Symbol(),0,OrderOpenTime());
ct=iBarShift(Symbol(),0,OrderCloseTime());
if(ot!=ct && iLow(Symbol(),0,iLowest(Symbol(),0,1,ot-ct,ct))< OrderOpenPrice() &&
(OrderOpenPrice()-iLow(OrderSymbol(),0,iLowest(Symbol(),0,1,ot-ct,ct))) / Point > lmae) {
lmae=NormalizeDouble((OrderOpenPrice()-iLow(Symbol(),0,iLowest(Symbol(),0,1,ot-ct,ct)))/Point,0); } }
if(Symbol()==OrderSymbol() && (OrderType()==1) && OrderProfit()>0) {
ot=iBarShift(Symbol(),0,OrderOpenTime());
ct=iBarShift(Symbol(),0,OrderCloseTime());
if(ot!=ct && iHigh(Symbol(),0,iHighest(Symbol(),0,2,ot-ct,ct))> OrderOpenPrice() &&
(iHigh(Symbol(),0,iHighest(Symbol(),0,2,ot-ct,ct))-OrderOpenPrice()) / Point > smae) {
smae=NormalizeDouble((iHigh(Symbol(),0,iHighest(Symbol(),0,2,ot-ct,ct))-OrderOpenPrice())/Point,0); } } } }

0 comments

Post a Comment

Related Posts with Thumbnails
Traffic Generator - Drive 33000 Hits a Day to your Website!
Build a Highway and drive
33,000 Hits a Day to your Website !

First, check out the sites in the box below. These are member sites which has participated in the program and can testify that this program truly works ! By visiting these sites, you will see why this program will work for you as well.

PARTICIPATING SITES - Visit them Today !

  1. Rencah kehidupan Merangkumi Nasihat, Petua, Resipi di samping berhibur dengan memuat turun lagu diki
  2. Menjual dan promosi alat-alat serta ubatan untuk lelaki sejati
  3. Make Money From Your Phone
  4. Malaysia Community Website with information on pubs, restaurants & businesses in Bangsar
  5. Webportal.com.my - Your Malaysian Portal
  6. Free Utilities, Tools and Scripts - XGEN Technologies


INSTRUCTIONS on how to get at least 33,000 Hits a day!

  • When you sign up, you will receive your own page just like this one. It will have your link and its description in position #1.In position #2 will be the link that is now in position #1 on this page. All other links are moved down as well and the one in #6 is dropped.

  • When people visit your page and sign up, they too will get a new page. And your link will be copied onto their page. Their page will have their link in position #1 and your link in position #2. And when people come to the pages created by the people who came to your page, your link goes to position #3, etc..


  • Of course the next step is to get visitors to your new "33,000 Hits a day" page. As a result, we recommend that you utilise our Auto URL Submission program to submit your Website Address to major search engines.

  • To prove that this program works, lets do some very conservative mathematics and assume that once your page is installed and promoted you only generates a total of 20 sign ups.
    Pages with your link!
    1. 20 people visit your page and get their own page 20
    2. These 20 pages each produce 20 sign ups producing 20 x 20 pages = 400 pages 400
    3. These 400 pages each produce 20 sign ups each, producing 400 x 20 = 8000 pages 8000
    4. These 8000 pages each produce 15 sign ups producing 8000 x 20 = 160,000 pages 160,000
    5. These 160,000 pages each produce 20 sign ups producing 160,000 x 20 = 3,200,000 pages 3,200,000
    Total pages with your link: 3,368,420


    Of these 3,368,420 pages with your link we will assume 1% of their visitors will actually click on your link and visit your page. That's 33,684 hits a day!. Additionally every page is generated by our script which means that the rotation and placement of your link is 100% accurate and cannot be removed or dropped prior to its natural demise.

    Sign up simply consist of your URL and your web site description..Your page will be generated immediately and then you can go on to our installation and free promotional pages.

    You should also appreciate the fact that there is no upper limit to the number of hits you can get, because you can keep your page for as long as you want and it in turn will generate more than the stipulated signup figure of 20.

    Also, after you have installed your page, there is no more work involved. Just let this system run by itself and it will give you 33,000 hits a day or more.

    Good Luck and make sure you place your generated page at a visible and easy to reach area so that people can join and make this program work!


    Please be sure to visit the above links before you sign up!!

    Ready?.. Go for it!! there is nothing to lose and fantastic traffic to gain!
    Enter your web site URL:

    Enter your web site description: (This must represent your website in 100 characters)




    XGEN Technologies - Banner Advertisement Program

    Copyrights © XGEN Technologies Sdn Bhd. All rights reserved.

    Amanda Beauty Store

    All About Iklan

    ........................

    ........................

    make money with your web site

    ........................

    ........................

    ........................

    ........................

    ........................

    All Malaysian Bloggers Project

    ........................

    ........................

    put your add here for RM 0.25/day

    (125x125)

    ........................

    put your add here for RM 0.25/day

    (125x125)

    msg me @ azrulahmad@yahoo dot com dot my for asking about my add

    ........................


    koleksi cerpen & novel

    ........................


    Joint GiffarineKL Groups

    nuffnang

    Archives

    Rencah Kehidupan

    My Twitter

    Twitter Value

    Ada sesiapa yang berminat nak beli?RM 10,362.34Your website value?

    Locations of visitors to this page Online Nutrition Degree - Courses & Training

    Followers

    mybloglog