At first I would check the values you receive from your indicator:
if(check == true) { down=iCustom(NULL,0,"ASCTrend",1,0); up=iCustom(NULL,0,"ASCTrend",0,0); if ( (down>0 && down<EMPTY_VALUE) || (up>0 && up<EMPTY_VALUE) ) Comment(TimeToString(TimeCurrent())," down: ",DoubleToStr(down,Digits)," up: ",DoubleToStr(up,Digits)) }//if(checkforTrade == true)
(There may by typos!)
Use M1 then you don't have to wait to long!
Thank you for helping. It comment the price of the drawn arrow. The problem is that the ea is opening at the moment multiple orders and I want that it opens only one order with 1 signal. Do you have an idea ?
1) save the ticket number in a global-variable e.g. int Ticket = -1; // no order
2) if(Ticket<0) Ticket = OrderSend(..);
3) if (doClose) { closeOrder(..); Ticket=-1; ..}
s.th. like that?
Hello,
Add the extern of your indicator :
down = iCustom(NULL,0,"ASCTrend1sig_noSound", RISK, CountBars,1,0);
if(down!=EMPTY_VALUE && opentrade ==false) { opensell();
You are checking against EMPTY_VALUE.val1[shift]=0; val2[shift]=0;
Indicator always sets the buffers to zero or a value.- Therefor, you ALWAYS open a sell.
- You would have seen this had you opened the data window (control-d) and looked at the indicator values.
First of all, thank you guys for helping.
@WHRoeder: So how can I fix that problem?
if(down>0) { opensell(); }// if(downtrend!=EMPTY_VALUE) else if(up>0) { openbuy(); }// else(uptrend!=EMPTY_VALUE)
Now the ea have to check if the value is bigger then 0 but the problem is still there, the ea open multiple trades on the same signal
if(down!=0.0 && opentrade ==false) { opensell();
still not working...
albo111:
still not working...
still not working...
You have made changes to your code. Post your code as it is now.
Good idea, that is the current version of the code
void OnTick() { if(check == false) { double Equity = AccountEquity(); Verlust = -Equity*RiskPercent*0.01; Gewinn = Equity*RewardPercent*0.01; double freeMargin = AccountFreeMargin(); halfMargin = freeMargin/4; rechnung = halfMargin*750; lots = rechnung/100000; check = true; } if(check == true && OrdersTotal()==0) { down=iCustom(NULL,0,"ASCTrend",1,0); up=iCustom(NULL,0,"ASCTrend",0,0); if ( (down>0 && down<EMPTY_VALUE) || (up>0 && up<EMPTY_VALUE) ) Comment(TimeToString(TimeCurrent())," down: ",DoubleToStr(down,Digits)," up: ",DoubleToStr(up,Digits)); }//if(checkforTrade == true) if(OrdersTotal() == 0 && check == true) { if(down>0 && down!=olddown) { opensell(); }// if(downtrend!=EMPTY_VALUE) else if(up>0 &&up!=oldup) { openbuy(); }// else(uptrend!=EMPTY_VALUE) }// if(OrdersTotal()==0) if(OrdersTotal()>0) { if(AccountProfit()>=Gewinn) { //oldup = up; olddown = down; closeallorders(); }// if(AccountProfit()>=Gewinn) if(AccountProfit()<=Verlust) { //oldup = up; olddown = down; closeallorders(); }// if(AccountProfit()<=Verlust) }// if(OrdersTotal()>0) }//void OnTick()

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
Hello, I need your help. I want that the ea open an order in the direction which the ea has give his signal but it doesent worked for any reason. Can someone help me?
The EA onTick
The indicator
ASCTrend