| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Need some experts' help to see my mistake https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3716 |
Page 1 of 1 |
| Author: | juniorlcq93 [ Sat Jul 05, 2014 1:59 pm ] |
| Post subject: | Need some experts' help to see my mistake |
Hello guys . I had been trying to make an trailing function inside my EA that will go through all orders in the pool , and modify by trailing the stop loss for every order in the pool that meets the condition . I tried it on 2 different demo account , but it seems like always the last order in the pool , the stop loss only moved ONCE which it actually should move more than once since it meet the trailing target . It only work sometimes not all the time , I'm not sure what's happening but I'd look through it many times the code SEEMS ( not confirmed ) fine TO ME . Anyone mind to give some help Code: Select all |
|
| Author: | milanese [ Sun Jul 06, 2014 8:58 am ] |
| Post subject: | Need some experts' help to see my mistake |
I am not sure what you want to, do but OrderClosePrice() will imo not work you should try with Bid and Ask, as OrderClosePrice() returns close price of the currently selected order, and you can only trail open and not closed orders..Cheers Tommaso |
|
| Author: | SteveHopwood [ Sun Jul 06, 2014 10:33 am ] |
| Post subject: | Need some experts' help to see my mistake |
Understand also that MarketInfo ( OrderSymbol() , MODE_POINT ) is notorious for returning zero, nicely buggering up everything. Dip into my shell code at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79 and use lifesys' pip factor conversion instead. You will also find a working trailing stop function you can adapt to your own needs. |
|
| Author: | juniorlcq93 [ Sun Jul 06, 2014 11:26 am ] |
| Post subject: | Need some experts' help to see my mistake |
Hi , what I wanted to build was to trail every pairs available in the pool singularly . Let's say I have 3 pairs currently floating , all these 3 pairs will be trail individually according to my trailing setup . 1st : When each individual order's price has a net movement of more than/equals to StartTrailingStop and the order's stop loss is equals to no stop loss OR stop loss is less or more than or equals to ( depending whether is buy/sell order ) open price OR stop loss is less or more than ( depending whether is buy/sell order ) open price + value of TrailingStop , it will move stop loss to open price + value of TrailingStop . 2nd : When each individual order's price has a net movement of more than/equals to StartTrailingStop + CummulativeValue and the order's stop loss is equals to the 1st's stop loss which is open price + value of TrailingStop , it will move new stop loss to open price + value of TrailingStop + CummulativeValue . 3rd : This part will start to trail accordingly . I uses a for loop for this part after the 1st and 2nd condition had met ..... I thought that OrderClosePrice() for opened orders is equal to the price stated on the right of the TP position in Empty4 ? |
|
| Author: | juniorlcq93 [ Sun Jul 06, 2014 11:43 am ] |
| Post subject: | Need some experts' help to see my mistake |
Hi Steve , hmmmph strange but my EA uses OrderClosePrice() works fine though ..... I uses MarketInfo in scripts .... |
|
| Author: | milanese [ Sun Jul 06, 2014 11:46 am ] |
| Post subject: | Need some experts' help to see my mistake |
no this is with BUY orders the Bid and with SELL orders the Ask price.. You should take a look to Steve's shell.. Cheers Tommaso Tommaso |
|
| Author: | juniorlcq93 [ Sun Jul 06, 2014 5:32 pm ] |
| Post subject: | Need some experts' help to see my mistake |
I tried swaping OrderClosePrice() to the MarketInfo one on the previous code and the edited ( removing the && condition and put them as a if statement after the previous if statement , the one in the 2nd for loop ) , but the result is still sometimes working sometimes not working . |
|
| Author: | SteveHopwood [ Sun Jul 06, 2014 8:46 pm ] |
| Post subject: | Need some experts' help to see my mistake |
Ok buster. It is entirely up to you whether you accept the advice offered to you here. You can continue to use MarketInfo if you want. Maybe one day, after many, many hours hunting through your code for a reason why a variable that clearly should not have a value of zero indeed has that value, your memory might dimly stir a passing recollection of the advice I offered you. You come across as a bit of a beginner in all this. I have been coding this stuff for about 8 years. More to the point, some of the truly professional coders here have helped me refine my code to the point that it is (mostly) fool proof. I have offered you advice. milanese is one of the cleverest people you will meet in this forum. He has been coding this stuff for years and laughs at the sort of thing you are having difficulty with. I have offered you advice. He has offered you advice. You appear to be rejecting all of this. This is not a good idea. Accept good advice when offered, or piss off an play in someone else's sandpit. Do not ask for help if you are unwilling to accept it when offered. It will not be offered a second time. To give you a tiny insight into what happens when someone like you annoys me a bit, this thread is now locked. Imagine what will happen if you annoy me a lot. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|