How to code? - page 286

 

Please fix this cript coder

Hi Coders

Can someone point out what's wrong with this script. I don't know how to make it work in different Broker

This script from IBFX. I try to place it to FXCM. after I saved it and compiled. It still doesn't work

Thanks

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

//| IBFX - Quick Buy.mq4 |

//| Copyright © 2010, InterbankFX LLC |

//| FX Trading, FX Currency Trading |IBFX| forex trading platform, forex trading account - Interbank FX |

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

#property copyright "Copyright © 2010, Interbank FX LLC"

#property link "http://www.ibfx.com"

#include

void start()

{

/*+-------------------------------------------------------------------------+

Because these scripts are meant to execute fast there are no user

external inputs. Make sure to modify the settings below, then compile

the script before assigning a hot key to it and using it.

The magicNumber HAS TO TO BE THE SAME ON ALL SCRIPTS if you change it

here make sure to change it on all scripts!!!

Do not forget to click on COMPILE once your changes have been made!!!

+-------------------------------------------------------------------------+*/

int MagicNumber = 915;

double Lots = 0.30; /* If you want to use a static lots value change this value! */

double Risk = 1.0; /* If you want the script to use % of your account to calculate

Lots to trade make sure Lots is set to 0.0 */

int Slippage = 3;

int StopLoss = 38; // Number in Pips ie: 50 for 50 pips.

int ProfitTarget = 40; // Number in Pips ie: 50 for 50 pips.

int MaxRetry = 10; // If the Order Fails - How many time do we retry?

string Commentary = "IBFX - Quick Buy ";

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

//| DO NOT MODIFY ANYTHING BELOW THIS LINE!!! |

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

Sym = Symbol();

SymPoints = MarketInfo( Sym, MODE_POINT );

SymDigits = MarketInfo( Sym, MODE_DIGITS );

if( SymPoints == 0.00001 ) { SymPoints = 0.0001; }

else if( SymPoints == 0.001 ) { SymPoints = 0.01; }

if( Lots <= 0.0 )

{

Lots = MM(Sym, Risk );

if( Risk <= 0 )

{

Alert( Commentary + "- Invalid Lots/Risk settings!" );

return;

}

}

Comment( "IBFX - QuickBuy | Placing Long Order, please wait ..." );

EnterLong( Sym, Lots, Commentary, StopLoss, ProfitTarget, MagicNumber, MaxRetry, Slippage );

Comment("");

return;

}

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

Here' second script

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

//| IBFX - Quick CloseAll.mq4 |

//| Copyright © 2010, InterbankFX LLC |

//| FX Trading, FX Currency Trading |IBFX| forex trading platform, forex trading account - Interbank FX |

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

#property copyright "Copyright © 2010, Interbank FX LLC"

#property link "http://www.ibfx.com"

#include

//----

void start()

{

/*+-------------------------------------------------------------------------+

Because these scripts are meant to execute fast there are no user

external inputs. Make sure to modify the settings below, then compile

the script before assigning a hot key to it and using it.

The magicNumber HAS TO TO BE THE SAME ON ALL SCRIPTS if you change it

here make sure to change it on all scripts!!!

Do not forget to click on COMPILE once your changes have been made!!!

+-------------------------------------------------------------------------+*/

int MaxRetry = 10; // If the Order Fails - How many time do we retry?

int Slippage = 10;

string Commentary = " IBFX - Close ALL orders";

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

//| DO NOT MODIFY ANYTHING BELOW THIS LINE!!! |

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

Comment( Commentary + " | Closing All Orders, please wait ..." );

CloseAll( "None", 0, OP_ALL ,MaxRetry, Slippage, Commentary );

Comment("");

return;

}

 

Scripts

Hi

By the look of it the scripts are written to only work with IBFX - #include -I don't see anything special about these 2 scripts there are similar scripts you can download from this forum that will achieve the same results.

Regards CJA

 

Paying is possible to eliminate DLL called ?

Paying is possible to eliminate DLL called in Expert Advisor .EX4?

thanks and Regards.

 

GBPJPY Daily Volatility Trade

i figured out what i was doing wrong. can delete post.

thanks

 

Newbie help - probably simple mistake?

Hi all,

I'm new to MT4 and MQL programming, although I've been a C and PHP programmer for about 15 years. Over the last few weeks I've been coding an EA in MQL and it seems to work ok - but it won't backtest. It doesn't produce a graph, it doesn't trade at all. It will backtest fine in Visual mode, and slowly produce a graph, and a final report, but not in non-visual mode. Backtesting in Visual mode takes a very long time!

I can't figure out what I'm doing wrong and I haven't found anything in the forums - has anyone seen this problem before?

Any help appreciated.

Andy

 
roxoid:
Hi all,

I'm new to MT4 and MQL programming, although I've been a C and PHP programmer for about 15 years. Over the last few weeks I've been coding an EA in MQL and it seems to work ok - but it won't backtest. It doesn't produce a graph, it doesn't trade at all. It will backtest fine in Visual mode, and slowly produce a graph, and a final report, but not in non-visual mode. Backtesting in Visual mode takes a very long time!

I can't figure out what I'm doing wrong and I haven't found anything in the forums - has anyone seen this problem before?

Any help appreciated.

Andy

[lang=pl]andy can you show us code ?

Cheers,

Grzesiek[/lang]

 

Check Pending Order

Hi!

first of all:new here...great site!

I have a problem I cant figeur out. The Search function and google couldnt help me, niether could the MQL4 Documentation nor MQL4 Tutorial... :/ I hope to get an answer here.

The problem i have is that I cant figuer out how to check if a pending order has open correctly. i specificly would like to check if a pending order has been rejected due to lack of funds. If i check for the last error with GetLastError() then i only get the code "0" and not "134", which represents "Not enough money". in my tester journal i get the msg "pending order is deleted[no enough money]" (seriosly "no enough money" ^^).

I know i could get this info with some type of logic code but, i would like to check what the system says. would reeeaaally appricate some suggestions/solutions .

Thanks alot!

 

Use Print And Comment To Find Errors

N0talent:
Hi!

The problem i have is that I cant figuer out how to check if a pending order has open correctly. i specificly would like to check if a pending order has been rejected due to lack of funds. If i check for the last error with GetLastError() then i only get the code "0" and not "134", which represents "Not enough money". in my tester journal i get the msg "pending order is deleted[no enough money]" (seriosly "no enough money" ^^).

I know i could get this info with some type of logic code but, i would like to check what the system says. would reeeaaally appricate some suggestions/solutions .

Thanks alot!

Hi NoTalent,

You can use a lot of PRINT and COMMENT statements in your code to find the errors. Place them in each section where it trades and where your Error Messages are.

COMMENTS display directly on the screen so you can see the values immediately while testing.

PRINT displays in your logs. Keep the tests short so your log is small and easier to find the errors.

Hope this helps,

Robert

 
cosmiclifeform:
Hi NoTalent,

You can use a lot of PRINT and COMMENT statements in your code to find the errors. Place them in each section where it trades and where your Error Messages are.

COMMENTS display directly on the screen so you can see the values immediately while testing.

PRINT displays in your logs. Keep the tests short so your log is small and easier to find the errors.

Hope this helps,

Robert

Hi Rob,

im aware of these gfunctions, but thanks for the tip. Like i mentiioned, I did display the Error code and didnt recive any when this senario happens. I dont like it, but i geusse im gonne have get this information through other commands telling me that the posisiont has been closed. If you have any suggestions i would be happy to hear them Thanks!

N0talent

 

Simply EMA crossover code need.........

hi friends,

I am a newbie. I have a simple strategy. I just scalping when EMA crossover. I just take only one trade in every crossover. I need some code which can take trade only one trade in every EMA crossover. Please......