Jump to content

Cable Run from Profitable FX


Recommended Posts

  • Replies 921
  • Created
  • Last Reply

Top Posters In This Topic

I've had a problem from time to time with CableRun.

I'm running a demo and the trades are being placed and the pending orders keep popping up. The basket is being filled. Everything is working ok.

Then a price move happens and the pending orders disappear and then there is that terrible gap between the price and the rest of the basket because no more trades are there to be triggered.

Edited by tomislav
Link to comment
Share on other sites

@ mrcrow: I dont think that's an error... it's just a warning; the compilation will still be successful and you should be able to run the bot without issues, unless the function in question is actually needed.

 

@ tomislav: heya, can you put up a screenshot displaying this issue with missing pending orders in the basket? Maybe if you do a visual backtest or if you already have a screenshot of the trades missing during the recent GU upsurge, that'd be cool...

 

sorry for the dump question above found the include file, no need to reply, but i am getting error (Function is not referenced and will be removed from exp-file) any body know how to rectify it?
Link to comment
Share on other sites

Thanks teknomage. I reckon the whole problem lies in the fact that I've been placing pending orders 1.7 pips apart. Too close especially when spreads increase during price action. I will test this week. I'm sure that this was the issue because it makes sense.

 

In an earlier post regarding Indo Run someone stated that the pending orders would disappear when the ATR filter kicked in for safety. There is a parameter in Indo Run 1.2 f called POATR when set to false would not let this happen.

If gaps appear in the trade basket with bigger step settings then I'll post a screen shot if I'm there to catch it.

 

hxxp://www.4shared.com/file/TX2_W6pM/CableMuruku24H_teknomage.html from post #570-latest teknomage Cable Run version with presets.

Edited by tomislav
Link to comment
Share on other sites

Hi guys,

 

Below is the latest from cable run

 

======

 

/*

Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []

Website: http://purebeam.biz

E-mail : [email protected]

*/

//#import "MQ4Check.dll"

// int getKey1();

//#import

 

extern int Step = 170;

extern double FirstLot = 0.1;

extern double IncLot = 0.0;

extern int Magic = 2008;

extern string PlaceTradesFrom = "00:00";

extern string PlaceTradesTo = "23:59";

extern double MinProfit = 15.0;

extern string MaxLoss = "0=none; 1=pips (position with largest loss); 2=percent (all orders)";

extern int MaxLossMethod = 1;

extern int MaxLossPips = 100;

extern int MaxLossPct = 5;

double g_ord_lots_144 = 0.0;

double g_ord_lots_152 = 0.0;

double gd_160;

double gd_168;

int gi_176 = 16749022;

int gi_unused_180 = 1774;

 

int start() {

int li_0;

if (idCheck_unique() != 1) {

li_0 = MyOrdersTotal(Magic);

if (GetTotalProfit(Magic) >= MinProfit) {

DeletePendingOrders(Magic);

CloseOrders(Magic);

}

if (MaxLossMethod == 1 && GetMaxLossPips(Magic) >= MaxLossPips) {

DeletePendingOrders(Magic);

CloseOrders(Magic);

} else {

if (MaxLossMethod == 2 && GetTotalProfit(Magic) <= (-1.0 * AccountBalance()) * MaxLossPct / 100.0) {

DeletePendingOrders(Magic);

CloseOrders(Magic);

}

}

GlobalVariableSet("OldBalance", AccountBalance());

if (!IsInTimeWindow(PlaceTradesFrom, PlaceTradesTo)) {

if (li_0 > 0) DeletePendingOrders(Magic);

Comment("not in trading window");

} else {

Comment("in trading window");

if (li_0 == 0) {

OrderSend(Symbol(), OP_BUYLIMIT, FirstLot, Ask - Step * Point, 3, 0, 0, "", Magic, 0, Green);

OrderSend(Symbol(), OP_SELLLIMIT, FirstLot, Bid + Step * Point, 3, 0, 0, "", Magic, 0, Red);

}

gd_160 = GetLastSellPrice(Magic);

gd_168 = GetLastBuyPrice(Magic);

if (gd_160 - Bid <= 5.0 * Point) OrderSend(Symbol(), OP_SELLLIMIT, g_ord_lots_144 + IncLot, gd_160 + Step * Point, 3, 0, 0, "", Magic, 0, Red);

if (Ask - gd_168 <= 5.0 * Point) OrderSend(Symbol(), OP_BUYLIMIT, g_ord_lots_152 + IncLot, gd_168 - Step * Point, 3, 0, 0, "", Magic, 0, Red);

}

}

return (0);

}

 

int DeletePendingOrders(int a_magic_0) {

int l_ord_total_4;

if (idCheck_unique() != 1) {

l_ord_total_4 = OrdersTotal();

for (int l_pos_8 = 0; l_pos_8 < l_ord_total_4; l_pos_8++) {

OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT) OrderDelete(OrderTicket());

}

}

return (0);

}

 

int CloseOrders(int a_magic_0) {

int l_ord_total_4;

if (idCheck_unique() != 1) {

l_ord_total_4 = OrdersTotal();

for (int l_pos_8 = 0; l_pos_8 < l_ord_total_4; l_pos_8++) {

OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) {

if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3);

if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3);

}

}

}

return (0);

}

 

int MyOrdersTotal(int a_magic_0) {

int l_count_4;

int l_ord_total_8;

if (idCheck_unique() != 1) {

l_count_4 = 0;

l_ord_total_8 = OrdersTotal();

for (int l_pos_12 = 0; l_pos_12 < l_ord_total_8; l_pos_12++) {

OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) l_count_4++;

}

}

return (l_count_4);

}

 

double GetLastBuyPrice(int a_magic_0) {

int li_4;

if (idCheck_unique() != 1) {

li_4 = OrdersTotal() - 1;

for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {

OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUYLIMIT || OrderType() == OP_BUY) {

g_ord_lots_152 = OrderLots();

return (OrderOpenPrice());

}

}

}

return (0);

}

 

double GetLastSellPrice(int a_magic_0) {

int li_4;

if (idCheck_unique() != 1) {

li_4 = OrdersTotal() - 1;

for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {

OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_SELLLIMIT || OrderType() == OP_SELL) {

g_ord_lots_144 = OrderLots();

return (OrderOpenPrice());

}

}

}

return (100000);

}

 

int GetMaxLossPips(int a_magic_0) {

int li_4;

int li_8;

bool li_ret_12;

if (idCheck_unique() != 1) {

li_ret_12 = FALSE;

li_4 = OrdersTotal() - 1;

for (int l_pos_16 = li_4; l_pos_16 >= 0; l_pos_16--) {

OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) {

if (OrderType() == OP_BUY) li_8 = Ask - OrderOpenPrice();

else li_8 = OrderOpenPrice() - Bid;

if (li_8 < 0 && MathAbs(li_8) > li_ret_12) li_ret_12 = MathAbs(li_8);

}

}

}

return (li_ret_12);

}

 

int GetTotalProfit(int a_magic_0) {

int li_4;

double ld_ret_8;

if (idCheck_unique() != 1) {

ld_ret_8 = 0;

li_4 = OrdersTotal() - 1;

for (int l_pos_16 = li_4; l_pos_16 >= 0; l_pos_16--) {

OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);

if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) ld_ret_8 += OrderProfit();

}

}

return (ld_ret_8);

}

 

bool IsInTimeWindow(string as_0, string as_8) {

string l_time2str_16;

if (idCheck_unique() != 1) {

l_time2str_16 = TimeToStr(TimeCurrent(), TIME_MINUTES);

if (as_8 > as_0) return (l_time2str_16 >= as_0 && l_time2str_16 <= as_8);

}

return (l_time2str_16 >= as_0 || l_time2str_16 <= as_8);

}

 

int idCheck_unique() {

//if (getKey1() == gi_176)

return (0);

//return (1);

}

 

======

Link to comment
Share on other sites

At placing of a pending order, the open price cannot be too close to the market. The minimal distance of the pending price from the current market one in points can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. In case of false open price of a pending order, the error 130 (ERR_INVALID_STOPS) will be generated.
Link to comment
Share on other sites

Hey mrcrow, with the first piece of code, notice that the name of the second buffer is misspelled as mubuffer... unless that typo was intended, just change that to mybuffer and see if that works. The period values 12 and 20 are fine, no worries there.

 

As for the second one, the code looks fine too... what's happening is that you're calculating the Money Flow Index for 14 bars from the current bar (i.e. shift=0) and also another calculation for MFI from the previous bar (shift=1) backwards by 14 bars. These two resulting MFI calculations are then compared. That's it...

 

By the way, i'm curious to know if you're applying iMomentumOnArray and iMFI to any of our Cable mods. Upload the mq4 code to 4shared and post the link here...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...