Coding help - page 285

 
hoosain:
Hi mladen, you helped me with some code for adding a time feature to EA. I am battling to get a ProfitTarget working. If u could add it to ea Blessing_3_V3_9_6 (I gave link in my earlier post) I would greatly appreciate it. Thank you.

hoosain

All you have to do is the following : loop through the orders and add up the profit for the orders you select. If the profit exceeds the one you expect, close all those orders. Something like this :

double totalProfit=0;

for (int i=OrdersTotal()-1; i>=0; i--)

{

if (!OrderSelect(i,SELECT_BY_POS)) continue;

if (OrderSymbol()!=Symbol()) continue;

if (OrderMagicNumber()!=Magic) continue;

if (OrderType()==OP_BUY || OrderType()==OP_SELL)

{

RefreshRates();

totalProfit += OrderProfit()+OrderSwap()+OrderCommission();

}

}

if (totalProfit>=ProfitWhenClose)

for (i=OrdersTotal()-1; i>=0; i--)

{

if (!OrderSelect(i,SELECT_BY_POS)) continue;

if (OrderSymbol()!=Symbol()) continue;

if (OrderMagicNumber()!=Magic) continue;

int type = OrderType();

if (type==OP_BUY || type==OP_SELL)

{

RefreshRates();

if (type==OP_BUY)

OrderClose(OrderTicket(),OrderLots(),Bid,3);

else OrderClose(OrderTicket(),OrderLots(),Ask,3);

}

}

 
mladen:
Joe Check the values of S1OkToOrder and S2OkToOrder variables. Almost sure that they are preventing you from entering new positions

Sorry Mladen, i try all i can, put true for S1OkToOrder, but nothing, and if i remove the S1OkToOrder, the ea enters infinite orders.

When you will have free time onde day

Thanks !

 
Big Joe:
Hello gurus,

I need just a little help.

Working again on my arbitrage ea.

It opens positions, to make arbitrage. At a specific hour, it adds positions. I get all that working.

But i want it adds positions to a second hour, and this time, i try all i can, but nothing, i'm on it since 2 days.

A wonderfull guru can take a look at it please ?

In the code, search for : ADD TO MAIN POSITIONS 2 (line 220) (the first "add positions" is working)

Thanks a lot !

Joe

Try it out now (the function for opening second position works with its own boolean variable - before it was using the variable that belonged to the first order opening function). Test if that solves the issue that you had :pegasus_arbitrage_short_1.47_ea_new_1.01.mq4

 
mladen:
Joe Try it out now (the function for opening second position works with its own boolean variable - before it was using the variable that belonged to the first order opening function). Test if that solves the issue that you had :pegasus_arbitrage_short_1.47_ea_new_1.01.mq4

Thanks for your time,

But nothing works. I tried others things this night and none works.

Can you add to the expert, just add a position everyday at desired hour.

Thanks for all, and take your time.

 

Hallo Everybody,I like to make a counter as, once RSI>70, counter = rx, and this value remain active (I will refer it in coding/use it in operation) till the situation RSI<30 (say this = ry). And vice versa. Can any body code for me please. Thanks.

Mizan Sharif

 
Mizan:
Hallo Everybody,I like to make a counter as, once RSI>70, counter = rx, and this value remain active (I will refer it in coding/use it in operation) till the situation RSI<30 (say this = ry). And vice versa. Can any body code for me please. Thanks.

Mizan Sharif

Sorry, what should it count?

You mean signals?

 

Hello Dear Mladen.

Please, I want you to ask to remake this indicator on a chart.That the price could be replaced in the form of the line AO, if it is possible. MACD actually isn't necessary in this indicator.

If you have time, make it please.

 
mladen:
Sorry, what should it count? You mean signals?

hey i have been using these 2 indicators for a week now and the results are amazing

hoping that you can help me put them together to make only one signal with alerts

they both already have alerts but i would like you to combine them so that only one signal comes.

i have added pictures of how it should look like in the zip file below

oh and am asking if you could keep the parameter, so i can change the values when necessary.

Download to send.zip from Sendspace.com - send big files the easy way

its not perfect has some losses but the stoploss is tight and less losses

oh and also use with higher trend direction for long trades and more pips.

i would really appreciate it if you helped me combine them together

thanks :-)

 

Hello, I know shifting indicators left/right is quite easy, but I was wondering if it's hard to shift an indicator up/down. Can someone give me a hint of what I should change in the code ? So far I've been using enveloppe, or levels for MA, but with some of them it doesn't really do the trick... It would only be for on chart indicators, like Ichimoku. Thanks for your help.

 
airquest:
Hello, I know shifting indicators left/right is quite easy, but I was wondering if it's hard to shift an indicator up/down. Can someone give me a hint of what I should change in the code ? So far I've been using enveloppe, or levels for MA, but with some of them it doesn't really do the trick... It would only be for on chart indicators, like Ichimoku. Thanks for your help.

The only way you can shift values vertically is by changing their values and that really does not give results as we expect them (it largely depends on the time frame or the symbol)