| 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 |
|
![]() |
|
|
LinkBack (1) | Thread Tools | Display Modes |
|
|||
|
Best way to add MaxBarsToCount (History) to the limit
whan we limit MaxBarsToCount (History) sometimes it require to add Correction, etc
is the best (safest, easiest, universal) way exists? ---------------------- like here we have light fisher 4 stoch smothing: ---------- int start() { int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); int limit=Bars-counted_bars; if(limit>maxbars)limit=maxbars; if (limit>Bars-lenth-1)limit=Bars-lenth-1; //---- for (int shift = limit; shift>=0;shift--) { AuxBuffer[shift]=(iStochastic(NULL,0,lenth,2,1,MODE_SMA,0,MODE_MAI N,shift)/100-0.5) +0.5*AuxBuffer[shift+1]; FishBuffer[shift]= 0.25* MathLog((1+AuxBuffer[shift])/(1-AuxBuffer[shift]))+ 0.5*FishBuffer[shift+1]; SignalBuffer[shift]=FishBuffer[shift+1]; } //---- return(0); } ------------------------ for fisher limit f-la: int limit; int counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=limit; i>=0; i--) { .... for Stoch: int start() { int i,k; int counted_bars=IndicatorCounted(); double price; //---- if(Bars<=draw_begin2) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=draw_begin1;i++) MainBuffer[Bars-i]=0; for(i=1;i<=draw_begin2;i++) SignalBuffer[Bars-i]=0; } //---- minimums counting i=Bars-KPeriod; if(counted_bars>KPeriod) i=Bars-counted_bars-1; while(i>=0) { double min=1000000; k=i+KPeriod-1; while(k>=i) { price=Low[k]; if(min>price) min=price; k--; } LowesBuffer[i]=min; i--; } .... p.s. in attached indicator, based on clean fisher transform and Stoch; MaxBars needs to be straighten-up a bit... (when MaxBars out - no problem) Last edited by fxbs; 01-19-2008 at 02:16 PM. |
|
|||
|
Hi,
Thanks a lot to all of you. It is working fine now and only one order per bar is opened. What is nice with an EA like this is that we can use the "Open price only" option for backtesting, which is faster than the "per tick" one. |
|
|||
|
Quote:
To check this (with MT 208), I used OrdersHistoryTotal() info. to decide trade direction on a martingaler, and used 'conventional means' on another version - the equity curve for both 'should' be identical. This is what I found......... ![]() I have also just checked with the latest Metatrader and the bug is still there - unbelieveable..... |
|
|||
|
Quote:
PS - my reply looks misleading. I meant you cannot retrieve historical swap rates - there's no problem getting current rates... Last edited by omelette; 01-21-2008 at 05:07 PM. |
|
|||
|
several Orders at one time
Hi,
I want to program in a Expert Advisor the following : I would like to open several Orders at the same time (3-6 Orders ) 1. Order : Volume; T/P; S/L; T/S . . . 5. Order : Volume; T/P; S/L; T/S Can help me ? Thanks derumuro |
|
|||
|
I need to learn something.
Hi all
I need a programming help for a simple code which is: If the market price > MA value by delta pips open buy. If the market price < MA value by delta pips open sell. With TP SL and TS. Can any expert programmer teach me how to write the code? Thank you |
|
||||
|
What do I need to do to change this code so the orders are only opened when all three indicators are in sync either uptrend (Blue) or downtrend (Red) manually this works well and is simple enough for me to follow LOL.
I have use an old ea as a template and tried to add the indis to create the right signals. at the moment orders are opened with either the TM or the HAS. I have attached the ea and performance for the last couple of days I know it does not mean squat but it has potential. IMO Could someone please point me in the right direction. Cheers Beno |
|
||||
|
Is there a way to code this include function so there is NO chance that it will get "stuck" in it's loop?
Code:
int CBM(int intMagic)//CloseByMagic
{
int intOffset=0;
while(OTBM(intMagic)>0)
{
OrderSelect(intOffset,SELECT_BY_POS);
if(OrderMagicNumber()==intMagic)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Red);
if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Orange);
}
else {
intOffset++;
}
}
return(0);
}
|
|
|||
|
Quote:
|
![]() |
| Bookmarks |
| Tags |
| candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
|
||||
| Posted By | For | Type | Date | |
| Need an experienced programmer? - Page 2 | Post #0 | Refback | 09-24-2008 07:24 AM | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 05:22 PM |