Ask! - page 145

 

Web service call with MQL

Does anybody know how to call external web services from an expert advisor ?

 
 

I guess this is something basic, just I do not know how to access it. Can someone tell me how to retrieve the Daily Open/Close from several days ago whether I am on a chart which is other than the Daily? Maybe provide sample code, it would be helpful.

Thx

ET

 

Look in the MetaEditor help for iopen and iclose

Lux

 
luxinterior:
Look in the MetaEditor help for iopen and iclose Lux

Thanks alot, its did the trick...

ET

 

Code fix request

Hello,

I am trying to modify the attached indicator to perform the following:

1) make start date coincide with the color1, right now the indicator plots the second color (color2) of the series onto the start date and not the first

2) output the date, color, open, high, low, and close of each plotted line in the series. The file would be appended as new data becomes available.

Thank you for your help in advance.

Regards,

 

Calc lowest low/use higher time frame trend/avoid spread problem

I'm trying to find some samples of coding that could provide for the following requirements:

In order to calculate placement of a stop I'd like to see coding that for any given time frame the EA could be told the LOWEST LOW (or highest high) during the last X number of bars...and then using THAT price less (or plus in the case of the highest high) X number of pips to set a stop level.

In order for any new short time frame order to be placed in the same direction as the trend of a larger time frame, I'd like to see coding that would allow new orders to be placed on the short time frame chart ONLY in the same direction as the trend of the larger time frame chart. As a simple example, assume an EA attached to a 15 minute chart wants to place a buy order on the crossing UP of MA1 over MA2 (with a stop placed as per the prior question at 5 pips below the lowest low of the last 5 bars) BUT I'm looking for coding that would only place that new order providing that on the one hour chart for that same pair, the current price is above (or below in the cases of a sell) an X period MA.

In order to avoid false openings/closings of orders due to unusual wide spreads, I'd like to see coding that would only trigger order action based on the CLOSE of the current (or even prior bar could be considered) rather than being triggered while a bar is still open. With IBFX for example I've seen spreads that were usually 5 pips often be as wide as 20 pips (and I once even saw 53 pips !). It seems that such wide spread action as often opened a new order because during the formation of the bar the MA's have temporarily crossed...but at the time the bar closed they had NOT crossed thereby leaving me with a buy order in place that was not wanted !

Any code samples to address of these things would be greatly appreciated.

 
Files:
 

Dear coderguru,

It is may be the easiest work in coding to change the color.......I am unable to do it............

Just change the support in a color and resistance in different color of this code.......

Here resistance and support are in similar color.....................

And the objects do not deleted when the indicator is deleted.............

Thanx in advance.............

Files:
 

Help with Trailling Stop / 1 Risk or Position M

Hi all,

i have tried do search in the forum a solution for my Problem:

At the begin of my EA:

//---- buy conditions

if(Ask > mybuyconditions)

{

ticket=OrderSend(Symbol(),OP_BUY,LotsLong(),Ask,Spread,Bid-(Ask-lowestof10bars),((BBupper-BBlower)/(Ask-lowestof10bars))*1000,"Einstieg 1",magic+1,0,Green);

}

//---- sell conditions

if(Bid < mysellconditions)

{

ticket=OrderSend(Symbol(),OP_SELL,LotsShort(),Bid,Spread,Ask+(highestof10bars-Bid),((BBupper-BBlower)/(highestof10bars-Bid))/100,"Einstieg -1",magic-1,0,Red);

}

//----[/CODE]

Stopploss: its easy 10 bars hi/lo

Takeprofit: here i write my formula for my Trailingstop, and that is:

Take the differenz of BBupper - BBlower at the order open time. Then divide by StopLoss in Pips and you have an Factor. Then take the actual BB differenz and divide it by this Faktor. NOW WE HAVE OUR VOLA BB TRAILINGSTOPP!!!!!

SO, my big problem is now to save this FAKTOR!!!! I saved it in th Takeprofit of Ordersend, it works but it is not right!!!!!

And know the 2te Question:

Position Management:

so my order is open and i have my trailing stopp that trails : So and now if the trailingstop is > orderopenprice send next ORDER!!! It's logical because so i can always sicure to risk just my 1 R Risk.

.... if Trailingstopp is > orderopenprice of secondOrder send 3te order.

HERE MY EXAMPLES:

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

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

{

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+1)

if(OrderStopLoss()< Bid-(oben-unten)/(OrderTakeProfit()/1000))

{

OrderModify(OrderTicket(),OrderOpenPrice(),High-(oben-unten)/(OrderTakeProfit()/1000),OrderTakeProfit(),0,Indigo);

return;

}

if(OrderStopLoss() > OrderOpenPrice() && CalculateCurrentOrders(Symbol()) == 1)

{

ticket1=OrderSend(Symbol(),OP_BUY,LotsLong(),Ask,Spread,Bid-(Ask-Low),((oben-unten)/(Ask-Low))*1000,"Einstieg 2",magic+2,0,Green);

return;

}

}

{

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+2 && CalculateCurrentAfterOrders(Symbol()) <= 1)

{

if(OrderStopLoss()<Bid-(oben-unten)/(OrderTakeProfit()/1000))

{

OrderModify(OrderTicket(),OrderOpenPrice(),High-(oben-unten)/(OrderTakeProfit()/1000),OrderTakeProfit(),0,Indigo);

return;

}

if(OrderStopLoss() > OrderOpenPrice() && CalculateCurrentOrders(Symbol()) == 2)

{

ticket2=OrderSend(Symbol(),OP_BUY,LotsLong(),Ask,Spread,Bid-(Ask-Low),((oben-unten)/(Ask-Low))*1000,"Einstieg 3",magic+3,0,Green);

return;

}

}

{

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+3 && CalculateCurrentAfterOrders(Symbol()) <= 2)

{

if(OrderStopLoss()< Bid-(oben-unten)/(OrderTakeProfit()/1000))

{

OrderModify(OrderTicket(),OrderOpenPrice(),High-(oben-unten)/(OrderTakeProfit()/1000),OrderTakeProfit(),0,Indigo);

return;

}

}

}

}

[CODE] if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

{

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+1)

{

{

OrderModify(OrderTicket(),OrderOpenPrice(),High-(oben-unten)/(OrderTakeProfit()/1000),OrderTakeProfit(),0,Indigo);

return;

}

if(OrderStopLoss() >= OrderOpenPrice() && CalculateCurrentOrders(Symbol()) == 1)

{

ticket1=OrderSend(Symbol(),OP_BUY,LotsLong(),Ask,Spread,0,0,"Einstieg 2",magic+2,0,Green);

return;

}

}

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+2)

{

if(OrderStopLoss() >= OrderOpenPrice() && CalculateCurrentOrders(Symbol()) == 2)

{

ticket2=OrderSend(Symbol(),OP_BUY,LotsLong(),Ask,Spread,0,0,"Einstieg 3",magic+3,0,Green);

return;

}

}

}

{

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+2)

{

if(CalculateCurrentOrders(Symbol()) == 0)

{

OrderClose(ticket1,OrderLots(),Ask,Spread,Red); return;

}

}

}

if(OrderType()==OP_BUY && OrderMagicNumber() == magic+3)

{

OrderClose(i,OrderLots(),Ask,Spread,Red); return;

}

I hope someone can help me with this problem!!!!! Thanks to all.

Reason: