How to code? - page 112

 
mifiglo:
Yeah thanks for offering to help, i have fixed the problem already, it was a problem with my indicator.

However i noticed that my EA doesn't trade according to the Buy or Sell Arrows, here's my EA code.

Thanks in advance for your prompt reply,

I am quite sure that your indicator repaints at least the current bar.

In your EA, in the iCustom() function you use the current bar (the last 0). Try to check the signal only at bar close (set the last number to 1). Then at the first tick of the new candle, if the arrow is still there (and not repaint), the trade won't be a false signal.

Note that I didn't checked it it repaints more than the current bar. But you get the idea.

FerruFx

 

Problem with Modifying Orders

I have a problem with an EA modifying orders from other EA's and Manual Trades. I use multiple EA's - some that modify the orders but the EA's that modify the orders take into account orders not associated with the EA. How can I have it only modify orders pretaining to a particular EA and not every order that is open for that currency. Thanks.

Kevin

 
Kaper:
I have a problem with an EA modifying orders from other EA's and Manual Trades. I use multiple EA's - some that modify the orders but the EA's that modify the orders take into account orders not associated with the EA. How can I have it only modify orders pretaining to a particular EA and not every order that is open for that currency. Thanks. Kevin

Hello!

Each ea can mark his orders by magic number. Use it to search in order pool for orders that you wish to be modified. In this case you can have other orders separated.

 

I find coder

Hello,

I find coder for this.

Is there somebody who can develop a EA to calculate the pips month.

Look at the example below.

if i give you EA source code to count pip can you change it in order it can works for all brokers because from now on it only works for FXDD.

 

Hi fungraphic. I moved your post.

I know you must have some hurry bue there is not need to post same twice. If somebody is interest in help it would reply.

 

Need Moving average stoploss code

I need code for using the moving average as a stoploss. The stoploss would change as the moving average changed so it would effectively be an adaptive stoploss based upon the moving average. Thanks

 

Tried this code. There will be a a static stop until the the price is above the moving averages for longs or below the moving average for shorts. Added code for a spread for the price of the last bar.

if(OrderType()==OP_BUY) // long position is opened

{

// check for trailing stop

if(TrailingStop>0&&(MaTrend<Low[1]-Spread*POINT))

{

OrderModify(OrderTicket(),OrderOpenPrice(),TrailingStop,OrderTakeProfit(),0,Green);

return(0);

}

}

else // go to short position

{

if(TrailingStop>0&&(MaTrend>High[1]+Spread*POINT))

{

OrderModify(OrderTicket(),OrderOpenPrice(),TrailingStop,OrderTakeProfit(),0,Red);

return(0);

}

}

 
free:
I need code for using the moving average as a stoploss. The stoploss would change as the moving average changed so it would effectively be an adaptive stoploss based upon the moving average. Thanks

You may look inside the code of this EA EA_based Trailing Stop as an example.

 

Rsi Ea

I have an ea that takes trades on a bar more than once. Is there any code that will allow only one trade per bar. EA attached.

Files:
rsi_test_1.mq4  11 kb
 

thanks i think u got the problem

FerruFx:
I am quite sure that your indicator repaints at least the current bar.

In your EA, in the iCustom() function you use the current bar (the last 0). Try to check the signal only at bar close (set the last number to 1). Then at the first tick of the new candle, if the arrow is still there (and not repaint), the trade won't be a false signal.

Note that I didn't checked it it repaints more than the current bar. But you get the idea.

FerruFx

Pls can u suggest a way to bypass the repaint problem if the indicator repaints more than the current bar?

thanks in advance

Reason: