stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Coding help needed
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5000
Page 1 of 1
Author:  LittleCaro [ Thu Dec 01, 2016 9:10 am ]
Post subject:  Coding help needed

Hello all,

I want a little help for coding, i want to know if previous trade was long or short.


So based on this code, i make a bool :

Code: Select all

bool Is previous trade long ()
{

if (OrdersHistoryTotal() == 0) return(false);
   
   for (int cc = OrdersHistoryTotal() - 1; cc >= 0; cc--)
   {
      if (!OrderSelect(cc, SELECT_BY_POS, MODE_HISTORY) ) continue;
      if (OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() != Symbol() ) continue;

But i'm stuck here, how differentiate the longs form the shorts ?

Can someone please could help me to correct my code, thanks a lot !
Author:  SteveHopwood [ Thu Dec 01, 2016 11:05 am ]
Post subject:  Coding help needed

LittleCaro » Thu Dec 01, 2016 9:10 am wrote:Hello all,

I want a little help for coding, i want to know if previous trade was long or short.


So based on this code, i make a bool :

Code: Select all

bool Is previous trade long ()
{

if (OrdersHistoryTotal() == 0) return(false);
   
   for (int cc = OrdersHistoryTotal() - 1; cc >= 0; cc--)
   {
      if (!OrderSelect(cc, SELECT_BY_POS, MODE_HISTORY) ) continue;
      if (OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() != Symbol() ) continue;

But i'm stuck here, how differentiate the longs form the shorts ?

Can someone please could help me to correct my code, thanks a lot !
Use the OrderType() function i.e.

Code: Select all

if (OrderType() == OP_BUY) return(true);

//Got this far, so the order was not a buy
return(false);
:xm:
Author:  LittleCaro [ Thu Dec 01, 2016 2:10 pm ]
Post subject:  Coding help needed

Thank you so much Steve !

It's working great !
Author:  jjasper7 [ Wed Dec 07, 2016 7:58 am ]
Post subject:  Coding help needed

i am trying to write an ea. would someone please tell me how to inform the mq4 platform and the MetaEditer where the Empty4 source and exe files are located? i want to put them in a folder located at 'c:\fx\experts'. and where should i look to find that information?
Author:  MathiasJ [ Wed Dec 07, 2016 8:36 am ]
Post subject:  Coding help needed

jjasper7 » 07 Dec 2016 09:58 wrote:i am trying to write an ea. would someone please tell me how to inform the mq4 platform and the MetaEditer where the Empty4 source and exe files are located? i want to put them in a folder located at 'c:\fx\experts'. and where should i look to find that information?
You need to put it in the MQL4\Experts folder.
BR
Mathias
Author:  SteveHopwood [ Wed Dec 07, 2016 10:20 am ]
Post subject:  Coding help needed

jjasper7 » Wed Dec 07, 2016 7:58 am wrote:i am trying to write an ea. would someone please tell me how to inform the mq4 platform and the MetaEditer where the Empty4 source and exe files are located? i want to put them in a folder located at 'c:\fx\experts'. and where should i look to find that information?
The Cretins at Crapperquotes have taken to hiding the Experts folder away locations impossible to find in Explorer. From your platform, Files/Open data folder will access it.

Add the '/portable' handle to the desktop shortcut forces Empty4 to create the data folder in the location of your chosen Empty4 installation. Right click the desktop shortcut and select Properties. Add '/portable' to the Target field. For example, the Target field for my Blindbot demo:
"C:\Users\piano\Desktop\Trading accounts\Blindbot\terminal.exe" /skipupdate /portable

The '/skipupdate' handle tells Empty4 not to auto-update and is probably irrelevant these days.

:xm:
All times are UTC Page 1 of 1