Download MetaTrader 5

Coding help - page 771

Ashwani1976
7
Ashwani1976  

Hi coder please guide me how change my this code.

I want ea set one tp for last OPEN order for all my previous open order like this image.

if(use_auto_tp) tp_prev_f();



////////////////////////////////////////////////////////////////////
void tp_prev_f()
{
int type;
double prev_price=-1;
double prev_tp=-1;
bool first=false;
for (int i=0; i<OrdersTotal(); i++)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber()!=Magic || OrderSymbol()!=Symbol()) continue;
if(!first)
{
first=true;
prev_price=OrderOpenPrice();
prev_tp=OrderTakeProfit();
continue;
}

type=OrderType();


if (type==OP_BUY)
{
if (Bid>=prev_price && OrderTakeProfit()<prev_tp)
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),prev_tp,0,clrNONE)) continue;
}
}
else
if (type==OP_SELL)
{
if (Ask<=prev_price && OrderTakeProfit()>prev_tp)
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),prev_tp,0,clrNONE)) continue;
}
}
}

Files:
Untitled.png 40 kb
whroeder1
18257
whroeder1  
Ashwani1976: I want ea set one tp for last OPEN order for all my previous open order like this image.
  1. When you post code please use the SRC button! Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. Please don't post a link to or attach an image, just insert the image.

  3. Check your return codes for errors and report them.
              What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles

  4. Help you with what? You haven't stated a problem. Show us your attempt and state the nature of your problem.
              No free help
              urgent help.
eliot6
37
eliot6  

I would like to modify this Fractal indicator that I attached so that I could modify the number of bars on side that has by default, this indicator that has the code open and can be modified, the number that I would like is 15/15, thanks

eliot6
37
eliot6  

I would like to modify this Fractal indicator that I attached so that I could modify the number of bars on side that has by default, this indicator that has the code open and can be modified, the number that I would like is 15/15, thanks

Simonjlovett
65
Simonjlovett  

Hi,

any help or pointing in the right direction would be greatly appreciated thanks.

does anyone know of an indicator or ea that looks back at a certain amount of candles for a candle with a total pip size of less then a certain number(say 30pips)+a certain number of pips on the h&L

Example, 

Looks back 4 candles and finds 3 candles within the range of the forth candle's total size of 28pips+15pips on the H&L then places sell and buy pending orders at the 15p with a TP of say 10 pips?


ps Im new to this so if my terminology sucks thats why. worst case does anyone know of the code i could use to make this.

Files:
5820Salem Alajmi
17
5820Salem Alajmi  
sisi:

Hi,

Mr. Guru could you please help me to constantly refresh an ea after each tick movement.

I have tried everything, But I just can't make it refresh constantly.

What lines of code must I insert to keep an ea and indicator refresh after every tick?

Tnx

tshikhudoc
8
tshikhudoc  
Could someone please assist in adding push notification to this indicator
Files:
Ayomi01
5
Ayomi01  
Please I need help on coding of fractal and horizontal lines on meta editor 5 
shevernadze
25
shevernadze  
Hello this indicator show S/R zones i need that somebody add option to connect last 2 Support and last 2 Resistance zones with trend lines and when new zone appears trend line moves further, and i need trend lines connect not with wicks but with body of candle so if its resistance zones trend line go from upper part of body to upper part of body and if support lower part of body to lower part of body
Glax
78
Glax  

Hi,

Please can anyone tell me how to fix this error.

I am trying to compile a script from trading view on MetaEditor.

//@version=2
//Heikin Ashi Strategy  V2 by breizh29

strategy("Heikin Ashi Strategy  V2",shorttitle="HAS V2",overlay=true,default_qty_value=1000,initial_capital=100000,currency=currency.EUR)
res = input(title="Heikin Ashi Candle Time Frame", type=resolution, defval="60")
hshift = input(1,title="Heikin Ashi Candle Time Frame Shift")
res1 = input(title="Heikin Ashi EMA Time Frame", type=resolution, defval="180")
mhshift = input(0,title="Heikin Ashi EMA Time Frame Shift")
fama = input(1,"Heikin Ashi EMA Period")
test = input(1,"Heikin Ashi EMA Shift")
sloma = input(30,"Slow EMA Period")
slomas = input(1,"Slow EMA Shift")
macdf = input(false,title="With MACD filter")
res2 = input(title="MACD Time Frame", type=resolution, defval="15")
macds = input(1,title="MACD Shift")




//Heikin Ashi Open/Close Price
ha_t = heikinashi(tickerid)
ha_open = security(ha_t, res, open[hshift])
ha_close = security(ha_t, res, close[hshift])
mha_close = security(ha_t, res1, close[mhshift])

//macd
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
macdl = security(ha_t,res2,macdLine[macds])
macdsl= security(ha_t,res2,signalLine[macds])

//Moving Average
fma = ema(mha_close[test],fama)
sma = ema(ha_close[slomas],sloma)
plot(fma,title="MA",color=lime,linewidth=2,style=line)
plot(sma,title="SMA",color=red,linewidth=2,style=line)


//Strategy
golong =  crossover(fma,sma) and (macdl > macdsl or macdf == false )
goshort =   crossunder(fma,sma) and (macdl < macdsl or macdf == false )

strategy.entry("Buy",strategy.long,when = golong)
strategy.entry("Sell",strategy.short,when = goshort)}




 Error1

Thank you :D