pivot_point___second_breakthrough New comment revilo1987 2014.03.24 21:40 Hey guys, I am new in trading and just started to make an Expert Adviser for automatic trading. So maybe there is a big mistake because it comes to NO trade :/ you can see the code downside: //+------------------------------------------------------------------+ //| Pivot_Durchbruch_M10.mq4 | //| Oliver Meyer | //| - | //+------------------------------------------------------------------+ #property copyright "Oliver Meyer" #property link "mailto:xxxxx" //+------------------------------------------------------------------+ //| Initiierung Funktionen | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| Hauptfunktion | //+------------------------------------------------------------------+ bool kauf=false; int start() { float tageshoch=iHigh(NULL,PERIOD_D1,0); float tagesschl=iClose(NULL,PERIOD_D1,0); float tagestief=iLow(NULL,PERIOD_D1,0); float vortageshoch=iHigh(NULL,PERIOD_D1,1); float vortagesschl=iClose(NULL,PERIOD_D1,1); float vortagestief=iLow(NULL,PERIOD_D1,1); int hp1_shift=iHighest(NULL,PERIOD_M30,MODE_HIGH,1,8); int hp2_shift=0; float pivot_p=(vortageshoch+vortagestief+vortagesschl); float pivot_r1=pivot_p*2-vortagestief; float pivot_r2=pivot_p*2+vortageshoch-vortagestief; if ((kauf==false) && (tageshoch>=Bid-2) && (tageshoch<=Bid+3)) { if (((iHigh(NULL,PERIOD_M30,hp1_shift)==tageshoch) || (iHigh(NULL,PERIOD_M30,hp2_shift)==tageshoch)) && (hp1_shift>=3) && (High[iHighest(NULL,PERIOD_M30,MODE_HIGH,1,hp1_shift-1)]<=pivot_r1)) { double stoploss=pivot_r1-2*MODE_POINT; double takeprofit=(pivot_r1+pivot_r2)/2; double volume=MathRound(ACCOUNT_BALANCE/100*2/Ask); int ticket=OrderSend(NULL,OP_BUY,volume,Ask,3,stoploss,takeprofit,NULL,0,0,clrGreen); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else { Print("OrderSend placed successfully"); kauf=true; }; } else; } else; if ((Bid==stoploss) || (Bid==takeprofit)) kauf=false; else; } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ Experts: Multi Lot Scalper Can I make an EA straight from..? How can I test to see if my broker allows me to do automatic trading or not? Alain Verleyen 2014.03.24 23:26 #1 Hello, Please use the SRC button when you post code. Thank you. This time, I edited it for you. revilo1987 2014.03.25 06:24 #2 Hello, Did You delete it? I can't see the code anymore. Please repost the code of You are able to. Thanks revilo1987 2014.03.25 06:26 #3 Oh, I can scroll sidewards New comment
Hey guys,
I am new in trading and just started to make an Expert Adviser for automatic trading.
So maybe there is a big mistake because it comes to NO trade :/ you can see the code downside: