You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Idea
OK boys and girls
I have been toying with the idea of just creating a CUF (Commonly used functions) - from all i have read you cannot call scripts from within an EA.
Notwithstanding - thinking of a workaround because I dislike being forced to redesign the wheel every time aswell as I am sure it would make things work better this way.
Scripts as everyone knows load do there thing then unload never to load again except if you press your shortcut keys.
This is a major major problem I see with all EA's is they seem to get stuck waiting for some time condition or some cruddy "sleep" condition to pass before they continue. This Makes cancelling and selling in a split second unlikely to happen what is a major failure in extremely volatile conditions what you could make a fortune from in a few seconds.
The solution? Make an CUFF indicator that works on global variables?? Has anyone tried this. The indicator cycles every tick so its perfect.
How to code an alert that will send sound or email alerts when multiple indicators and bar conditions are met?
hi,
being a newbie I would like to ask if the built-in metastock function: ref() and stochmomentum() are implemented by some functions in metatrader
thnx
Darian see my above example of globals. find a script that emails /whistles /does what you want and code it into it. mind you you will have to consider that they all wont go off at precisely the same time so you will have to put a few second /minute delay into it before you reset the variables back to 0.
with Global
can I add a GlobalVarible to an Indicator like this ?
if ( trend[2]0 && Volume[0]>1 && !UpTrendAlert)
{
GlobalVariableSet("trend"+Symbol(),1);
// Print("UP" + GlobalVariableGet("trend"+Symbol()));
Message = " Buy "+Symbol()+" M"+Period()+": Signal for BUY";
if ( AlertMode>0 ) Alert (Message);
UpTrendAlert=true; DownTrendAlert=false;
then call that GlobalVariable in an EA with
int init() {
GlobalVariableDel("trend"+Symbol());
trend = GlobalVariableGet("trend"+Symbol());
Buy = (trend == 1);
Sell = (trend == 2);
all help appreciated
You could however if you trade more then 1 currency that wont work.
Trouble with Arrays, need some help!
Hi,
I am trying to make a function that determines if any open order is losing more money than a cutoff point (say, $-1000).
The function is then supposed to store the OrderTicket() and the OrderProfit() in two separate arrays, and exit with return (1) to signify that the cutoff point has been reached.
Before it stores the values in those arrays, it should check the OrderTicket() array to see whether this order is already filed.
If the OrderTicket number is already stored in the array, it is supposed to determine if the order has lost an ADDITIONAL $1000, and if so: replace value in the OrderProfit() array with a fresh value, and exit with return(1) to signify that a NEW cutoff point has been reached. If the order has not lost an additional $1000 (called Cutoff) then it should return(0) to signify that no order has lost an additional $1000.
I think I pretty much have it working (not sure??), but for some reason the array gets filled with a lot of '0' values along with the legitimate values. The output of the array is as follows:
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 431 ResumeArrayPrices[k] = -3042
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 425 ResumeArrayPrices[k] = -3042
ResumeArrayTickets[k] = 386 ResumeArrayPrices[k] = -1008
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 371 ResumeArrayPrices[k] = -12933
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 320 ResumeArrayPrices[k] = -6057
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 249 ResumeArrayPrices[k] = -5076
ResumeArrayTickets[k] = 241 ResumeArrayPrices[k] = -1017
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 230 ResumeArrayPrices[k] = -13122
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
ResumeArrayTickets[k] = 186 ResumeArrayPrices[k] = -4068
ResumeArrayTickets[k] = 128 ResumeArrayPrices[k] = -1008
ResumeArrayTickets[k] = 0 ResumeArrayPrices[k] = 0
[/code]
The following is my actual code:
[code]
int CheckForResume()
{
ResumeCheck = TimeLocal()+(PERIOD_M1*60)*5;
}
int arraycount1 =1;
int arraycount2 =1;
bool found = false;
int k;
for (int i = 0; i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if ((OrderType() == OP_BUY) || (OrderType() == OP_SELL))
{
if (OrderProfit()< Cutoff)
{
for (k=0; k<ArraySize(ResumeArrayTickets); k++)
{
if ((ResumeArrayTickets[k] == OrderTicket()) && ResumeArrayTickets[k] !=0)
{
found = true;
if (ResumeArrayPrices[k] + Cutoff < OrderProfit())
{
return (0);
}
else
{
Print ("ELSE");
arraycount1 = ArrayResize(ResumeArrayTickets,ArraySize(ResumeArrayTickets) + 1);
arraycount2 = ArrayResize(ResumeArrayPrices,ArraySize(ResumeArrayPrices) + 1);
ResumeArrayTickets[k] = OrderTicket();
ResumeArrayPrices[k] = OrderProfit();
return (1);
}
}
}
if (found == false)
{
arraycount1 = ArrayResize(ResumeArrayTickets,ArraySize(ResumeArrayTickets) + 1)'
arraycount2 = ArrayResize(ResumeArrayPrices,ArraySize(ResumeArrayPrices) + 1);
ResumeArrayTickets[k] = OrderTicket();
ResumeArrayPrices[k] = OrderProfit();
return (1);
}
}
}
return (0);
}
}
Refreshing an EA once a Bar
Hi, is there a way to refresh an EA so that it reacts like the first time it is initialized? (Like a restart) It need s to be done once a Bar. E.g. once every 30 minutes.
RefreshRates() and WindowRedraw() do not do it properly.
I would also like to retain a few variables as well and not lose the data.
Is there a way this can be done?
I would also like to be able to do this for an indicator as well.
Many thanks.
Programming Help
Hello all,
I am working on modifying a currency strength meter to show the strength of the currency based on the time from of the chart. At present, the code used is:
aLow = MarketInfo(mySymbol,MODE_LOW); // set a low today
aBid = MarketInfo(mySymbol,MODE_BID); // set a last bid
aAsk = MarketInfo(mySymbol,MODE_ASK);I understand MODE_HIGH and MODE_LOW get the current days highs and low. How could I get the high and low of the charts current time frame instead?
Thanks!
P.S. I am not a programmer, so use small words please:)
Look in the help manual for iHigh and iLow functions.
good luck
Lux