Hello everybody. I have working (searching the forum) the past few weeks and managed to pull together an EA that does not compile errors any longer but the structure of it's all wrong and because is not executing at the correct times. I was hoping some kind soul can take a look and help me to restructure my EA and perhaps give some explanation of the modifiions. Thanks in advance for any help, I will pass it as I understand.

This is what I am attempting to accomplish with my EA:

I have these extern inputs:
Lots=0.03;
Target_In_Dollars=5; This really is actually the goal at which I shoot for about the pair with all available orders (max 3) that informs the trailing stop to kick
Trailing_Stop=50;
Max_Orders=3;
Closed_Bars=0;
Distance_Back=24;
ADX=75; The trade will not open if 8period ADX is above 75
extern int Magic=717171;
This is what's supposed to happen.... When a pub closes the EA check back 24 pubs to for the signal, when its a move (signal is fulfilled and ADX lt; 75 and not exceeds max orders per) it opens the order of.03 lots at the ask price (no SL or TP in the time of order). When the entire price of all open orders on this chart with same magical number (717171) total $5 or greater it is supposed to modify all available orders on this chart with that magical number with all the trailing stop.

While there are no errors the EA does not function quite like explained. I am convinced it is based on the structure and parentheses etc.. .

Thanks in advance for anyone taking the time to maintain my hand this one time. Here is the code:
Inserted Code // ------------------------------------------------------------------ //| DoppkeEA.mq4 | // ------------------------------------------------------------------ extern double Lots=0.03; extern double Target_In_Dollars=5; extern int Trailing_Stop=50; extern int Max_Orders=3; extern int Closed_Bars=0; extern int Distance_Back=24; extern int ADX=75; extern int Magic=9348670; int begin () int EAOrdersTotal=0; int mTotal = OrdersTotal(); for(int I = mTotal-1; igt;=0; I--) OrderSelect(I,SELECT_BY_POS,MODE_TRADES); should (OrderMagicNumber() ==Magic OrderSymbol() ==Symbol()) EAOrdersTotal ; if(OrderProfit() gt;=Target_In_Dollars) OrderSelect(I,SELECT_BY_POS,MODE_TRADES); RefreshRates(); if(OrderType()==OP_BUY OP_SELL OrderMagicNumber()==Magic OrderSymbol()==Symbol()) if (OrderStopLoss() ==0) OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(Bid-Point*Trailing_Stop,Digits),OrderTakeProfit(),0,Bl ue); //OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue); double sig = Lowest(NULL,0,MODE_LOW,Distance_Back,0); should (EAOrdersTotal lt; Max_Orders) if (iADX(NULL, 0, 8, PRICE_CLOSE, MODE_MAIN, 0) lt; ADX) if(Closed_Bars! =Bars sig==1) RefreshRates(); OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,DoppkeEA, Magic,0,Blue); string AN=ArrBuy TimeToStr(CurTime()); ObjectCreate(AN,OBJ_ARROW,0,TimeNumber 91;1#93;,Low#91;1#93;-6*Point,0,0,0,0); ObjectSet(AN, OBJPROP_ARROWCODE, 233); ObjectSet(AN, OBJPROP_COLOR, Blue); sig = Highest(NULL,0,MODE_HIGH,Distance_Back,0); should (EAOrdersTotal lt; Max_Orders) if (iADX(NULL, 0, 8, PRICE_CLOSE, MODE_MAIN, 0) lt; ADX) if(Closed_Bars! =Bars sig==1) RefreshRates(); OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,DoppkeEA ,Magic,0,Magenta); AN=ArrSell TimeToStr(CurTime()); ObjectCreate(AN,OBJ_ARROW,0,TimeNumber 91;1#93;,Top #91;1#93; 6*Point,0,0,0,0); ObjectSet(AN, OBJPROP_ARROWCODE, 234); ObjectSet(AN, OBJPROP_COLOR, Magenta); Closed_Bars=Bars; return(0);