
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
First of all don't try to declare a function inside another function.
I am unable to work out what you are trying to do by looking at the code that you have posted. So I can't help you.
Thank you GumRai for your prompt reply. My program has many conditions like following. I checked upto P12. Its like a pivot. If conditions satisfies, then it opens limit trades on those levels P1, P2,....as its number is 12. I didn't want to write up buy/sell code on every instance. That's why made separate buycall/sellcall functions. Below my old code for sell.
This is the example. Same trade placing on each tick. I need to place this on each hour. As its an hourly pivot.
When you open a sell limit, you set BuyTicket to 0.
Next you check if BuyTicket==0, of course it does, you've just set it.
Then you set SellTicket to 0.
Next tick, Sellticket==0 so you open a sell limit and set BuyTicket to 0 again.
and so on and so on............
When you open a sell limit, you set BuyTicket to 0.
Next you check if BuyTicket==0, of course it does, you've just set it.
Then you set SellTicket to 0.
Next tick, Sellticket==0 so you open a sell limit and set BuyTicket to 0 again.
and so on and so on............
Then should I remove that two lines you highlighted. I did that. Now showing just one hour result for 2 months data back testing.
Another thing I notice, in my sellcall, I have a reverse trade on buy. If sell trade get stopped out then buy trade will open. Now for sellcall function it returns(Selltickets) so is it ok?
Thank you
I understand now in this code, first it checks sellticket == 0 yes obvious, then placed sell order, next buyticket == 0 yes, next places buy order...but when return...again check sellticket == 0 , no its not now...so that's why Ea stopped after taking one set. But how to remove this problem. In my EA inactive pending orders get deleted on each 59 minutes from start hour. I set it in that way.
Now I changed the code in following way, it reading for all support & resistance.
I have maximum 6 support & 6 resistance for an hour. Among those 6 meet the conditions, then it opens limits orders on that 6. If 1 meet then opens limits orders for that one. This is the algo.
So I set the code in following way for function call.
Now it runs for one hour & checks for 6 levels for each buy/sell. But runs for only a hour. What to do here to run it perfectly for full data set.
This will only work in the strategy tester and will do nothing more once the first 6 orders are opened.
You cannot use a ticket number for a test in this way
This will only work in the strategy tester and will do nothing more once the first 6 orders are opened.
You cannot use a ticket number for a test in this way
Thank you for your reply.
Then what should I do. If I remove the BuyTicket =>0 or any BuyTicket conditions. Then EA is taking many same trades with every tick.....Giving me ordersend error of 148.
Thank you for your reply.
Then what should I do. If I remove the BuyTicket =>0 or any BuyTicket conditions. Then EA is taking many same trades with every tick.....Giving me ordersend error of 148.
We don't know what you are trying to do
If you only want one open trade at a time, check that there are no open orders before sending a new one.
If you only want one trade per bar, only test once per bar
If you want a combination of conditions, test the combination.