Coding help - page 491

 
brijeshsinh:
hello,

mladen, mr tools can you please help change following settings in indicator FXUltraTrend posted below to

--- show in seperate window as line, (or histogram) with arrows to show color change if possible (by default in present setting it paints bars on main chart)

---- and if possible to add column for different settings, so as it can be changed according to our wish. ( in current default mode it does not have any column to add settings)

attaching below indicator and its image for you

fxultratrend.mq4

hope you will not mind me for taking some time of you, but you guys are doing great job for someone like us who are new to this platform and not knowing programming.

you really deserve appreciation from me and from all members on this forum for your valuable efforts.

thanks for quick reply for previous post.

If you have the original (non-decompiled) source code of that indicator post it so that someone can alter it (I doubt that anybody is going to change decompiled code)

 

i have only this indicator that i have posted.

thanks for reply mladen.

it is nice to hear from you again.

 
tfi_markets:
Hi Mladen,

you are right, please find the code below which is calling "OpenSell()".

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

//| OPEN BUY / OPEN SELL

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

//----------------------- BUY CONDITION

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

if(OrderType()==OP_SELL) break;

{

if(STC1!=STC2)

{

/*if(STC1STC1)BUY="true";*/

if(STC1STC1)

/*if((STC115) || (STC185)) // code for buy */

OpenBuy();

return(0);

}

openedOrders++;

}

//----------------------- SELL CONDITION

// if(STC1>STC0&&STC2<STC1)SELL="true";

//if((STC1>15 && STC285 && STC2<85)) // code for sell

if(STC1>STC0&&STC2<STC1) // code for sell

{

OpenSell();

return(0);

}

}

//----------------------- OPEN SELL

void OpenSell()

{

double lsStop = 0; if(sStopLoss>0) lsStop = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)+sStopLoss *pPoint*pipMultiplier,digit);

double lsTake = 0; if(sTakeProfit>0) lsTake = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)-sTakeProfit*pPoint*pipMultiplier,digit);

if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }

// ECN

if(!EcnBroker)

dummyResult=OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,lsStop,lsTake,ExpertName,MAGIC,0,clOpenSell);

else

{

int sellTicket = OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenSell);

if(sellTicket >= 0)

bool sellOrderMod=OrderModify(sellTicket,OrderOpenPrice(),lsStop,lsTake,0,CLR_NONE);

if(sellOrderMod==false)

{

int ErrorCode = GetLastError();

string ErrDesc = ErrorDescription(ErrorCode);

string ErrAlert=StringConcatenate("Modify Sell Order - Error ",ErrorCode,": ",ErrDesc);

if(ShowAlerts==true) Alert(ErrAlert);

string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",sellTicket," Stop: ",lsStop," Profit: ",lsTake);

Print(ErrLog);

}

}

}

Check what errors are you getting in the experts or journals tab of the terminal

 
mladen:
Check what errors are you getting in the experts or journals tab of the terminal

There are no real errors, this is exactly what makes me puzzling.

It looks like this:

2015.06.17 17:20:26.823 2014.07.29 17:10 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #3 buy 0.10 EURUSD at 1.34175 ok

2015.06.17 17:20:26.799 2014.07.29 17:05 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 17:05:00 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.792 2014.07.29 17:03 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 17:03:13 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.714 2014.07.29 16:40 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 16:40:00 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.064 2014.07.29 14:06 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 14:06:09 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:25.827 2014.07.29 11:55 SchaffTrendCircle_EA v1.3 EURUSD,M5: close #2 buy 0.10 EURUSD at 1.34353 sl: 1.27353 tp: 1.74353 at price 1.34356

2015.06.17 17:20:25.818 2014.07.29 11:50 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 11:50:01 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.816 2014.07.29 11:48 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 11:48:17 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.486 2014.07.29 09:15 SchaffTrendCircle_EA v1.3 EURUSD,M5: modify #2 buy 0.10 EURUSD at 1.34353 sl: 1.27353 tp: 1.74353 ok

2015.06.17 17:20:25.486 2014.07.29 09:15 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #2 buy 0.10 EURUSD at 1.34353 ok

2015.06.17 17:20:25.479 2014.07.29 09:12 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 09:12:11 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:25.426 2014.07.29 08:45 SchaffTrendCircle_EA v1.3 EURUSD,M5: close #1 buy 0.10 EURUSD at 1.34345 sl: 1.27345 tp: 1.74345 at price 1.34277

2015.06.17 17:20:25.421 2014.07.29 08:42 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 08:42:19 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.378 2014.07.29 08:05 SchaffTrendCircle_EA v1.3 EURUSD,M5: modify #1 buy 0.10 EURUSD at 1.34345 sl: 1.27345 tp: 1.74345 ok

2015.06.17 17:20:25.378 2014.07.29 08:05 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #1 buy 0.10 EURUSD at 1.34345 ok

[/CODE]

I guess the problem may lie somewhere in there:

[CODE]

//----------------------- CLOSE BUY CONDITION

.

.

.

string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod.... maybe here.

}

}

//----------------------- CLOSE SELL CONDITION

.

.

.

ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod ----- maybe here.

}

}

}

}

 
tfi_markets:
There are no real errors, this is exactly what makes me puzzling.

It looks like this:

2015.06.17 17:20:26.823 2014.07.29 17:10 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #3 buy 0.10 EURUSD at 1.34175 ok

2015.06.17 17:20:26.799 2014.07.29 17:05 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 17:05:00 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.792 2014.07.29 17:03 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 17:03:13 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.714 2014.07.29 16:40 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 16:40:00 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:26.064 2014.07.29 14:06 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 14:06:09 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:25.827 2014.07.29 11:55 SchaffTrendCircle_EA v1.3 EURUSD,M5: close #2 buy 0.10 EURUSD at 1.34353 sl: 1.27353 tp: 1.74353 at price 1.34356

2015.06.17 17:20:25.818 2014.07.29 11:50 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 11:50:01 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.816 2014.07.29 11:48 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 11:48:17 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.486 2014.07.29 09:15 SchaffTrendCircle_EA v1.3 EURUSD,M5: modify #2 buy 0.10 EURUSD at 1.34353 sl: 1.27353 tp: 1.74353 ok

2015.06.17 17:20:25.486 2014.07.29 09:15 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #2 buy 0.10 EURUSD at 1.34353 ok

2015.06.17 17:20:25.479 2014.07.29 09:12 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 09:12:11 Non Lag Schaff Trend Cycle changed direction to up

2015.06.17 17:20:25.426 2014.07.29 08:45 SchaffTrendCircle_EA v1.3 EURUSD,M5: close #1 buy 0.10 EURUSD at 1.34345 sl: 1.27345 tp: 1.74345 at price 1.34277

2015.06.17 17:20:25.421 2014.07.29 08:42 NonLag_Schaff_TrendCycle EURUSD,M5: Alert: EURUSD M5 at 08:42:19 Non Lag Schaff Trend Cycle changed direction to down

2015.06.17 17:20:25.378 2014.07.29 08:05 SchaffTrendCircle_EA v1.3 EURUSD,M5: modify #1 buy 0.10 EURUSD at 1.34345 sl: 1.27345 tp: 1.74345 ok

2015.06.17 17:20:25.378 2014.07.29 08:05 SchaffTrendCircle_EA v1.3 EURUSD,M5: open #1 buy 0.10 EURUSD at 1.34345 ok

[/CODE]

I guess the problem may lie somewhere in there:

[CODE]

//----------------------- CLOSE BUY CONDITION

.

.

.

string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod.... maybe here.

}

}

//----------------------- CLOSE SELL CONDITION

.

.

.

ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());

Print(ErrLog);

}

break;

} // mod ----- maybe here.

}

}

}

}

That means that the conditions for entering order opening procedure are never fulfilled. Check the conditions in that case

 

Hello Masters

can you please guide me how to add live quote to the alert msg

thanks

 
AAREMM:
Hello Masters

can you please guide me how to add live quote to the alert msg

thanks

Simply add something like DoubleToStr(price,_Digits) to the alert message

 
mladen:
Simply add something like DoubleToStr(price,_Digits) to the alert message

HaHaHa

have tried but fail

rsi_bollinger_bands_1.01_amp_lines__alerts_arrows.mq4

plz add to this so i can try again

the error is this 'price' - undeclared identifier

thanks for kind attention

 
AAREMM:
HaHaHa

have tried but fail

rsi_bollinger_bands_1.01_amp_lines__alerts_arrows.mq4

plz add to this so i can try again

the error is this 'price' - undeclared identifier

thanks for kind attention

"price" was placed there so that you can replace it with the price (or value) you wish to use instead of the price. Use "Close[0]", "Ask", "Bid" or any other price (value) that you want to be displayed in the alert

 
mladen:
"price" was placed there so that you can replace it with the price (or value) you wish to use instead of the price. Use "Close[0]", "Ask", "Bid" or any other price (value) that you want to be displayed in the alert

Okay Sir trying again

Thanks again to guide me

I Have Done it thanks a tonne Sir mladen

Reason: