Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Strategy start on first transaction
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=146&t=49119
Page 1 of 1

Author:  bufferpl [ Wed 24 Apr, 2013, 12:15 ]
Post subject:  Strategy start on first transaction

Hello, I am looking for a way to start a strategy after i make a position.

Example: I buy eur/usd manually, and after this the strategy starts running by itself.

Author:  Visual Support [ Wed 24 Apr, 2013, 12:42 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
Hello, I am looking for a way to start a strategy after i make a position.

Example: I buy eur/usd manually, and after this the strategy starts running by itself.

It is quite easy, see examples.
You need to create check for filling or opening the position, and set the appropriate variable "isStrategyStart".

Attachments:
checkTradebeforeStart.vfs [18.96 KiB]
Downloaded 434 times
CheckTradebeforeStart.PNG [124.91 KiB]
Downloaded 472 times

Author:  bufferpl [ Wed 24 Apr, 2013, 18:55 ]
Post subject:  Re: Strategy start on first transaction

Thanks a lot for respose. Unfortunately I'm not very good at this.
Now im trying to make the strategy set a stop loss for my manual transaction, and if that SL triggers, open a new transaction with SL and TP and so on.
I am unable to do it, so if You could provide me some kind of template for this or example i could work on, it would be great.
Cheers and thanks a lot.

Author:  Visual Support [ Thu 25 Apr, 2013, 08:47 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
Now im trying to make the strategy set a stop loss for my manual transaction, and if that SL triggers, open a new transaction with SL and TP and so on.

See the examples.
The idea, that from TradeEvent you can get the message type, you can check it and do what you need with this position.

Attachments:
checkTradebeforeStart.vfs [27.51 KiB]
Downloaded 431 times
CheckTradebeforeStart2.PNG [215.99 KiB]
Downloaded 502 times

Author:  bufferpl [ Thu 25 Apr, 2013, 12:35 ]
Post subject:  Re: Strategy start on first transaction

Thanks again, now i think im slowly getting the hang of it, but i don't know how to tell the IF operator wheather my transaction ended with SL or TP. I need to open different transactions for SL and TP, and i think i got the logic correct, just don't know witch parameters to input.
I attach the example.

Image

Attachments:
forx.jpg [187.07 KiB]
Downloaded 785 times

Author:  Visual Support [ Thu 25 Apr, 2013, 12:59 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
Thanks again, now i think im slowly getting the hang of it, but i don't know how to tell the IF operator wheather my transaction ended with SL or TP. I need to open different transactions for SL and TP, and i think i got the logic correct, just don't know witch parameters to input.

Thanks for example. But as we can see the image is wrong.
1) First the Open at Market, already has definitions for SL and TP inside this block
2) You connect the "Position Fill" from Open at Market to the Multiple Action, and then you use the TradeEvent message in case Position.Reject - it can not be so, becouse the Position cant be Filled and Rejected simultaneusly.
We reccomend you to use the TradeEvent start point, if the any Position will be filled (check it with IF blocl), then set to this position needed SL and TP, with separate blocks.
We hope that this helps.

Author:  bufferpl [ Thu 25 Apr, 2013, 13:25 ]
Post subject:  Re: Strategy start on first transaction

Im not sure if we understand eachother correctly.
Im not trying to set the SL or TP but if transaction ended with TP open new transaction and if it ended with SL i want to open other transaction, like in the example.
Image

Attachments:
forx.jpg [239.59 KiB]
Downloaded 842 times

Author:  Visual Support [ Fri 26 Apr, 2013, 08:18 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
Thanks again, now i think im slowly getting the hang of it, but i don't know how to tell the IF operator wheather my transaction ended with SL or TP. I need to open different transactions for SL and TP,

Let's try to figure out the strategy requirements one more time. As you wrote above, you need to open one "type" of order
if a previous order was closed by a stop loss price, and another "type" of order if a previous order was closed by a take profit price.
If you make first order manually and then your strategy has to manage SL or TP, you have to use the "ProfitLoss in USD" or the "ProfitLoss in Pips" value from the TradeEvent section.
Please see the example below.
Image

Attachments:
TradeEvent.jpg [251.79 KiB]
Downloaded 793 times
TradeEvent.vfs [21.73 KiB]
Downloaded 419 times

Author:  bufferpl [ Sun 28 Apr, 2013, 11:58 ]
Post subject:  Re: Strategy start on first transaction

Thanks a lot for help. I just need two more things.

1.If closed position was BUY then the new one open SELL.
2. How to loop it all: after few transactions go back to first transaction.

Cheers and thanks again.

Author:  Visual Support [ Mon 29 Apr, 2013, 10:33 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
1.If closed position was BUY then the new one open SELL.
2. How to loop it all: after few transactions go back to first transaction.

1. Check the example. You need just to use the closed position type to check it.
2. Can you describe more what exactly you need? Why you need the first transaction data?
You can use to store the data with new variable and "Assign" block.

Attachments:
TradeEvent2.vfs [21.59 KiB]
Downloaded 407 times
TradeEvent2.PNG [142.06 KiB]
Downloaded 413 times

Author:  bufferpl [ Mon 29 Apr, 2013, 15:23 ]
Post subject:  Re: Strategy start on first transaction

Thanks.

I need strategy to run forever in a loop. Like in the example.
Image

Attachments:
forex.png [18.32 KiB]
Downloaded 713 times

Author:  Visual Support [ Mon 29 Apr, 2013, 15:47 ]
Post subject:  Re: Strategy start on first transaction

bufferpl wrote:
I need strategy to run forever in a loop. Like in the example.
Image

You already has a loop (in our example), becouse the new Transaction will generates according TradeEvent.
Or you can choose the "blue" flow outs from trading blocks.
Just try the strategy in action, on historical tester.

  Page 1 of 1