manu29
10
manu29  

Thanks a lot for your reply. Is not a problem with arguments, the calculation in the loop is correct. I think the problem is with the second call to iMAonArray outside the loop in function.

Regards

fxbs
3203
fxbs  

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_MAIN,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=0;

for(i=1;i<=draw_begin2;i++) SignalBuffer=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=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)

dvarrin
279
dvarrin  

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.

omelette
784
omelette  
Michel:
Hi Omelette, Do you know that BT have a problem looking in the history: it looks on the real history, not the one of the BT. I asked Metaquote few months ago about this bug but they didn't have any answer.... Maybe now it's fixed...

Michel, thank for the heads-up. Wow, I didn't know that - and I'd rate that as a huge bug!!!

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.....

arsenic786
271
arsenic786  

Need MQL Code

Hello there,

I need few code that I can integrate it in an EA.

1) I need to put a restriction to my EA like that, it should not open any position between 2:00 PM to 5:00 PM. How can I do that? please give me this simple code and tell where I can place it in EA.

2) I don't want to put SL in EA to open position because of SL hunting by broker. So, I need to put a check on EA that "if total profit on opened position is +20 points then close position".

I will be very thankfully to the supporters who always support other people!

Best Regards,

Kashif.

omelette
784
omelette  
oilfxpro:
.....Can EA look at swaps current and swaps historical rates? OILFXPRO

Afraid not.

PS - my reply looks misleading. I meant you cannot retrieve historical swap rates - there's no problem getting current rates...

derumuro
49
derumuro  

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

agarwalsharma
54
agarwalsharma  

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

Beno
1163
Beno  

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

wolfe
1037
wolfe  

Is there a way to code this include function so there is NO chance that it will get "stuck" in it's loop?

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);

}

Thanks to anyone who can help.