| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
| View Poll Results: Your trading timeframe | |||
| 5 Mins |
|
0 | 0% |
| 10 Mins |
|
0 | 0% |
| 15 Mins |
|
2 | 13.33% |
| 30 Mins |
|
6 | 40.00% |
| 1 Hr |
|
2 | 13.33% |
| 4 Hrs |
|
5 | 33.33% |
| Voters: 15. You may not vote on this poll | |||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Getting my pivots to update at a different closing time.
Here's the indicator. Basicly all it is is a pivot point indicator which used fibonacci #'s to calculate support and resistance instead of the standard pivot calcs. Now, I can only seem to make it update at 00:00 GMT which is exactly what it's asked to do in the code, because I can't figure out a way to make it happen any other way. Check out line 132 as I'm pretty sure that's where you could use the LocalTime() variable to set a cutoff and make the pivot point and retracements/extentions update. I'd be greatful for any help. Thanks!!!
PHP Code:
|
|
|||
|
Stop loss for EA
Sorry for the above title, what I need is a take profit command. I have no idea how to code but would like to add a Take Profit to this ea. Below is the code please add take profit where necessary. Thanks again
Ray extern double MaximumRisk =0.02; //%account balance to risk per position extern double DecreaseFactor =3; //lot size divisor(reducer) during loss streak extern double Lot.Margin =50; //Margin for 1 lot extern int Magic =69; extern string comment ="m icwr ea"; double spread; spread =Ask-Bid; int slip; slip =spread/Point; int RequiredWaveHeight,b,s,cnt,ticket; double rsi,SL,ICWR,ICWRv0,awp1,awp2,active.high,active.lo w,high.c,high.r,low.r,low.c; datetime awt1,awt2,a.high.shift,a.low.shift,shift; int init(){return(0);} int deinit(){return(0);} int start(){ PosCounter(); rsi=iRSI(Symbol(),1440,14,PRICE_CLOSE,0); if(Period()==5) {RequiredWaveHeight=40;SL=50*Point;} if(Period()==240) {RequiredWaveHeight=150;SL=100*Point;} ICWR=iCustom(Symbol(),Period(),"ICWR",10,5,3,Requi redWaveHeight,0,0); ICWRv0=iCustom(Symbol(),Period(),"ICWR v0","ZigZag",10,5,3,"ActiveWave",50,RequiredWaveHe ight,0,0); awt1=ObjectGet("Activewave",OBJPROP_TIME1); awp1=ObjectGet("Activewave",OBJPROP_PRICE1); awt2=ObjectGet("Activewave",OBJPROP_TIME2); awp2=ObjectGet("Activewave",OBJPROP_PRICE2); if(awp1>awp2) { active.high=awp1; a.high.shift=iBarShift(Symbol(),Period(),awt1); active.low=awp2; a.low.shift=iBarShift(Symbol(),Period(),awt2);} else { active.high=awp2; a.high.shift=iBarShift(Symbol(),Period(),awt2); active.low=awp1; a.low.shift=iBarShift(Symbol(),Period(),awt1);} if(a.high.shift<a.low.shift) shift=a.high.shift; else shift=a.low.shift; high.c=NormalizeDouble(active.low+((active.high-active.low)*0.75),Digits); high.r=NormalizeDouble(active.low+((active.high-active.low)*0.618),Digits); low.r=NormalizeDouble(active.low+((active.high-active.low)*0.382),Digits); low.c=NormalizeDouble(active.low+((active.high-active.low)*0.25),Digits); if(rsi>50) { for(int i=0;i<shift;i++) { if(Close[i]<high.r && Close[i]>low.r && Low[1]>high.c && b==0) { ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,Bid+2 0*Point,Bid-30*Point,"expert comment",255,0,CLR_NONE); OP_BUY, LotsOptimized(), Ask, slip, Ask-SL, 0, Period()+comment, Magic,0,Blue); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) { Print(ticket); } else Print("Error Opening BuyStop Order: ",GetLastError()); return(0);}}}} if(rsi<50) { for(int ii=0;ii<shift;ii++) { if(Close[ii]<high.r && Close[ii]>low.r && High[1]<low.c && s==0) { ticket=OrderSend(Symbol(), OP_SELL, LotsOptimized(), Bid, slip, Bid+SL, 0, Period()+comment, Magic,0,Orange); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) { Print(ticket); } else Print("Error Opening SellStop Order: ",GetLastError()); return(0);}}}} if(b>0) { for(int c=0;c<shift;c++) { if(High[1]<low.c) { OrderClose(ticket,OrderLots(),Bid,slip,0);}}} if(s>0) { for(int cc=0;cc<shift;cc++) { if(Low[1]>high.c) { OrderClose(ticket,OrderLots(),Ask,slip,0);}}} comments(); return(0);} //+---------------------------FUNCTIONS------------------------------+ void PosCounter() { b=0;s=0;ticket=0; for(cnt=0;cnt<=OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) { if(OrderType()==OP_SELL) { ticket=OrderTicket(); s++;} if(OrderType()==OP_BUY) { ticket=OrderTicket(); b++;} }}} void comments() { if(MarketInfo(Symbol(),MODE_SWAPLONG)>0) string swap="longs."; else swap="shorts."; if(MarketInfo(Symbol(),MODE_SWAPLONG)<0 && MarketInfo(Symbol(),MODE_SWAPSHORT)<0) swap="your broker. ";Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n" , "Swap favors ",swap,"\n", "Daily RSI= ",rsi,"\n", "Active High: ",active.high,"\n", "High shift: ",a.high.shift,"\n", "High Confirm: ",high.c,"\n", "High Retrace: ",high.r,"\n", "Low Retrace: ",low.r,"\n", "Low Confirm: ",low.c,"\n", "Active Low: ",active.low,"\n", "Low shift: ",a.low.shift); } double LotsOptimized() { double lot; int orders=HistoryTotal(); int losses=0; lot=NormalizeDouble(AccountFreeMargin()*MaximumRis k/Lot.Margin,2); if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==fals e) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,2); } if(lot<0.01) lot=0.01; return(lot); }//end LotsOptimized Last edited by ray4498; 02-02-2006 at 02:20 PM. |
|
|||
|
New chart disables EA?
Hello agian,
(This is such a great board, I'll have something to share soon!) I'm playing around with CodersGuru's "Your First Expert Advisor" example from his MQL4 Course... I've noticed something that I hope has a solution... After loading the EA on the 30M chart... it Opened a (Short) Order.. I had modified his code to test my Exit strategy (a simple cross on a lower time period)... The cross came and went (and the printed status, and my code was correct) HOWEVER, I was on the 15M chart at the time... does this mean I de-activated the EA (so my code/logic didn't run)? If so, is there anyway around this... I'd like to click back and forth to other timeframes... without disabling the EA that is running. Thanks in advance for the replies. -charliev |
|
||||
|
System effectiveness proportional to its user growth?
Do you guys believe that a system would gain or lose its effectiveness along with an increasing number of people who apply it?
It seems that many successful traders do not usually share their trading strategies, so there must be a reason for them doing so. Anyone want to crack at this? |
|
|||
|
Quote:
BTW, I think it is personal. One trader can use some trading strategy and I can not because of my character, habits, timezone etc. So it is personal. Anyway we may discover all the strategies as we are doing already here in the forum. |