| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Basket SL & TP within a single chart https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4698 |
Page 1 of 4 |
| Author: | traderduke [ Sat Apr 30, 2016 1:26 pm ] |
| Post subject: | Basket SL & TP within a single chart |
I need help to build a Void or function that can be added to an existing EA. This function needs to address: input bool doBasketExit = true; // Check for Basket Exit conditions input double BasketTP = 250.0; // Basket Take Profit (Account Currency) The chart Pair input double BasketSL = -100.0; // Basket Stop Loss (Account Currency) The chart Pair I’m running 9 pairs/Charts with BnG-v1w H1 and I want pair specific basket trading on each of the 9 charts. Here's what just happened to me. 9 charts running, 3 charts are in trade with, of course, 3 separate pairs, each with 15 trades, yes 45 trades open, 2 are in profit & one is losing badly. I looking for a way to add up each group of the 15 separately and rub each group against a Basket SL & TP boundaries. Why do I want this, I can't hedge so this my Stop_And_Limit_Order idea, crazy or not?? I was searching other EAs & TMs and found this at Rene's MADTrader 1.1, lines 372-418. I hoping someone can help me change this to a Basket specific pair “CloseAll” See the following code for starters from Rene's MADTrader 1.1, lines 372-418: Code: Select all Ray |
|
| Author: | SteveHopwood [ Sat Apr 30, 2016 6:29 pm ] |
| Post subject: | Basket SL & TP within a single chart |
Trying to do this from within an auto-trader that is intended to trade only one pair is a recipe for chaos. If one ea trading the three pairs recognises the closure condition, then so will the other two. Yes, you can get them talking to one another, but only with a lot of difficulty and it is not worth the effort. You suggest any method of doing so and I bet you a pound to a penny that I can explain how this will break. Guess how I know? You need to write/obtain a basket manager to do this for you. |
|
| Author: | SteveHopwood [ Sat Apr 30, 2016 6:37 pm ] |
| Post subject: | Basket SL & TP within a single chart |
I just read your reply in APTM. I think I get what you are after. You need x profitable baskets closing to offset a losing one. It would be horrible to code. Just sitting here contemplating the complexity makes my head reel. Mind, I am on my second glass of dinner wine. Having said that, maybe we are merely taking about Offsetting again? This time, whole baskets are offset instead of groups of trades. Not sure. It is still a basket manager and not a function of a single-pair EA. Good luck coding that one. |
|
| Author: | traderduke [ Sat Apr 30, 2016 9:51 pm ] |
| Post subject: | Basket SL & TP within a single chart |
Steve Thanks for at least understanding. I thought I was going nuts and couldn't speak enough English to get my point across. I'm on my second Black Russian, that's a trip. I wouldn't have this problem in Tradestation but nobody could translate this Godzilla into easy language, you are the man. Thanks a lot for all of it. I don't know how you keep up with it. Best Regards Ray |
|
| Author: | renexxxx [ Sat Apr 30, 2016 11:31 pm ] |
| Post subject: | Basket SL & TP within a single chart |
You can turn this muti-symbol closeAll() function into a pair specific closeAll(), like so: Code: Select all Code: Select all Rene. |
|
| Author: | traderduke [ Sun May 01, 2016 8:20 pm ] |
| Post subject: | Basket SL & TP within a single chart |
rene I appreciate your help. Its your TradeReport that got me thinking this was possible. I've searched TSD, FF and the internet for answers. I'll attach the void & the EA. My simplistic idea was If I have 9 charts & attach a magic number from 1-9 or comment the pair, such as EU, of each chart could we add up the OrderProfit trades by Symbol and check them against the Basket SL & TP, certainly sounds reasonable. My v1w void is on lines 5821-5871. Thanks again for the interest Ray See Attached Code: Select all |
|
| Author: | renexxxx [ Sun May 01, 2016 8:51 pm ] |
| Post subject: | Basket SL & TP within a single chart |
I still don't quite understand what it is you're after. Let me try to fish out that specification. 1. You have 9 charts (for 9 different symbols), each running a (single-symbol) EA, that is opening and closing one or more trades of that symbol it is attached to. You could call the collection of these trades, a (symbol specific) basket. Now it gets fuzzy, but let's try: 2. You need a multi-symbol basket controller EA that: 2.1 Works out the profit for each (symbol specific) basket 2.2 Closes the (symbol specific) basket if it passes some test (this could be that the basket profit exceeds a BasketTP or drops below a BasketSL, however, in this case, this code could go inside the single-symbol EA that is attached to the 9 charts) May be this partial specification, jogs your mind, and helps you to formulate what you need. There is no need to give the 9 single-symbol EA's different Magic Numbers and/or Order Comments, as you can keep trades apart by just looking at their symbol name. |
|
| Author: | traderduke [ Mon May 02, 2016 12:39 am ] |
| Post subject: | Basket SL & TP within a single chart |
Exactly, I only mentioned the magic number to give more options. So far using this BnG-v1w with a H1 TF and running it from EDT 01:00 to 11:00 using .03 pips. I have been LUCKY enough to manually close 4 winners averaging 350 a close, some right through the JPY slide. The v1w does the entry and the basket could do the close. Sorry to ramble thanks for the interest Ray |
|
| Author: | traderduke [ Fri Jun 10, 2016 3:21 pm ] |
| Post subject: | Basket SL & TP within a single chart |
Rene I have been hoping you find time for my request. I am still interested. I agree with your solution which follows; I need a multi-symbol basket controller EA or function within the single-symbol EA that: 1 Works out the profit for each (symbol specific) basket 2 Closes the (symbol specific) basket if it passes some test (this could be that the basket profit exceeds a BasketTP or drops below a BasketSL, however, in this case, this code could go inside the single-symbol EA that is attached to the 9 charts. Yes, a function that could be added to an existing EA such as BnG which buys and sells several of the same symbol. This would weed out the losers and let the winners roll. Look forward to hearing from you Thank You for your interest in my problem Ray |
|
| Author: | renexxxx [ Fri Jun 10, 2016 9:14 pm ] |
| Post subject: | Basket SL & TP within a single chart |
I have attached some snippets of code that you can use for this purpose: In a nutshell, assuming that each single-chart EA (that opens multiple symbols and multiple of the same symbol), has a unique MagicNumber:
Have fun. |
|
| All times are UTC | Page 1 of 4 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|