Ask! - page 172

 

Thanks ND

Where can I find a zerolag-true-stochastic?

 

Script to add lots to open orders in profit

Hi everyone,

I'm trying to write a script that adds lots to open orders that are in profit. The problem is I need to implement refreshrates somewhere because by the time the last orders go through it is still using the same price data.

If anyone could help me out I'd really appreciate it.

Thanks everyone...

Heres the code:

#property show_inputs

#include

//+------------------------------------------------------------------+

//| script program start function |

//+------------------------------------------------------------------+

int start()

{

int total,cnt,err;

total = OrdersTotal();

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderProfit() >= 15) // profit is greater than 15 pips

if(OrderType()==OP_BUY)

OrderSend(OrderSymbol(),OP_BUY, 0.1, MarketInfo(OrderSymbol(),MODE_ASK), 2, NULL, NULL, NULL, NULL, NULL, CLR_NONE);

else

OrderSend(OrderSymbol(),OP_SELL, 0.1, MarketInfo(OrderSymbol(),MODE_BID), 2, NULL, NULL, NULL, NULL, NULL, CLR_NONE);

err=GetLastError();

Print("error(",err,"): ",ErrorDescription(err));

Sleep(1000);

}

//----

//----

return(0);

}

Thanks in advance everyone...

Cheers

Jeff

 
targus:
Thanks ND Where can I find a zerolag-true-stochastic?

It should be here:

https://www.mql5.com/en/forum/172902

 

Work with dll

Hi ND,

Could you please point me in a right direction:

1. I need to learn more about mutual work of dll and MT, namely: how MT runs dll which is written in C++; how dll sources in MT4 quotes and outputs signals back to MT4 and so on. Please point me to a book and smaples of code.

2. I used to have indicator which was parsing news from some external news provider (I believe FF) and soursing them in MT4 and displaying them in a any TF window. Or you came across something similar.

Thank you in advance

 
bershk:
Hi ND,

Could you please point me in a right direction:

1. I need to learn more about mutual work of dll and MT, namely: how MT runs dll which is written in C++; how dll sources in MT4 quotes and outputs signals back to MT4 and so on. Please point me to a book and smaples of code.

2. I used to have indicator which was parsing news from some external news provider (I believe FF) and soursing them in MT4 and displaying them in a any TF window. Or you came across something similar.

Thank you in advance

Hi bershk,

as to item 2 (parsing news from some external news provider) so you can use this example:

https://www.mql5.com/en/forum/177102 - indicators sourcing the news in MT4, and EA trading news in MT4. They are in mql4 source codes so you can download and open in metaEditor to see it as example.

Those indicators and EAs are using our tsd forex calendar.

Those indicators and EA are using one dll (you will find it on the thread and inside the code of those indicators/EA - you will fine the examples about how it was implemented/coded in mql4.

As to FF news provider so look at this thread https://www.mql5.com/en/forum/176404

This thread https://www.mql5.com/en/forum/173834

https://www.mql5.com/en/forum/175881

about your first question:

https://www.mql5.com/en/forum/172885

 

dll and news

Thank you very much ND!

You are as usual very helpful

Regards,

Victor

newdigital:
Hi bershk,

as to item 2 (parsing news from some external news provider) so you can use this example:

https://www.mql5.com/en/forum/177102 - indicators sourcing the news in MT4, and EA trading news in MT4. They are in mql4 source codes so you can download and open in metaEditor to see it as example.

Those indicators and EAs are using our tsd forex calendar.

Those indicators and EA are using one dll (you will find it on the thread and inside the code of those indicators/EA - you will fine the examples about how it was implemented/coded in mql4.

As to FF news provider so look at this thread https://www.mql5.com/en/forum/176404

This thread https://www.mql5.com/en/forum/173834

https://www.mql5.com/en/forum/175881

about your first question:

https://www.mql5.com/en/forum/172885
 

tim

Hello Dear CodesGuru

My question is simple I believe but I could not figure out how to manage it.

So I want to write this code in EA,

If (highprice - lowprice) < 60 pips between 02:00 GMT and 10:00 GMT then sell AUDUSD at lowprice - 5pips or buy AUDUSD at highprice + 5pips, otherwise no trade

I want to create this simple automated trading order but I am unable, could you help?

thanks

 

Drag and Drop Stop Loss

Hello everyone

I have Drag and Drop Stop loss script, and a love to use it. But with my broker dose not work for 2 orders in a same scart only set 1 order. I want to set stop loss for 2 orders in same place.

What is the problem ? It is work fine for other broker.

Please help

int start()

{

//----

int digits = MarketInfo(Symbol(),MODE_DIGITS);

double value = NormalizeDouble(WindowPriceOnDropped(),digits);

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

{

if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

continue;

if(OrderSymbol()!=Symbol())

continue;

RefreshRates();

if(OrderType()==OP_BUY)

if(value<Bid)

OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);

if(OrderType()==OP_SELL)

if(value>Ask)

OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);

if((OrderType()==OP_BUYSTOP) || (OrderType()==OP_BUYLIMIT))

if(value<OrderOpenPrice())

OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);

if((OrderType()==OP_SELLSTOP) || (OrderType()==OP_SELLLIMIT))

if(value>OrderOpenPrice())

OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);

}

return(0);

}

//+------------------------------------------------------------------+

 

Help

Im trying to make my first EA, but i cant figure out how to make it, here is the rules it should have

If close above EMA 7 (Buy)

If close under EMA 7 (Sell and Sell short)

If close above EMA 7 (Buy to cover and buy)

 

First Lesson Question

2;76;;;cannot open the program file

I made the text file, can't compile it when i run the above is the error that comes out of (my_first_mql4_script.log) which appears instead of the ex4 file.

Made the notepad file a .bat file like the first lesson said and saved its contents:

cd C:\Program Files\UpFX Trading Station

metalang -q "C:\Program Files\UpFX Trading Station\my_first_mql4_script.mq4"