|
Newbie needs help |
tbm
|
Post subject: Newbie needs help |
Post rating: 0
|
Posted: Wed 29 Oct, 2014, 17:00
|
|
User rating: 0
Joined: Tue 28 Oct, 2014, 21:49 Posts: 4 Location: GermanyGermany
|
Hey guys, I just started some days ago with VisualJforex and have a few questions: 1. How to open a order with no SL or TP at the beginning? "Open at Market" always needs SL and TP, am I right? 2. Lets say a simple Algorithm opens Orders at Open Price of each Candle... How to implement Orders beeing Closed at Close Price of current Period? I think I got it wrong trying to close all open positions with an IF Statement that's beeing executed when last Tick = Last Tick Candle Close (see attachment below) VJF says "29.10.2014 15:47:40 Cannot close order in CREATED, CLOSED or CANCELED state, current state - [CLOSED]" May the problem be that last close and open price can be the same and so orders are opened and directly closed again? 3. Last question is about calculation. Lets say I want to open a buy position whenever the difference between the upper and lower bollinger band reaches a minimum over x periods. Does anybody know how to do that? Who ever reads this ... thank you very much in advance for your help. Yours, tbm 
Attachments: |
File comment: question is concerning on Tick statements
VJF.JPG [63.37 KiB]
Downloaded 573 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Newbie needs help |
Post rating: 2
|
Posted: Thu 30 Oct, 2014, 11:33
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hello there and welcome !
1. How to open a order with no SL or TP at the beginning? "Open at Market" always needs SL and TP, am I right? Simply remove the variable SL and TP from the open@market block by clicking on the cross sign in the right side of the variable (you need to place the cursor on the variable to see it).
2. Lets say a simple Algorithm opens Orders at Open Price of each Candle... How to implement Orders being Closed at Close Price of current Period?
Assuming that you will work with the last candle data, you have to access these variables from the left side and under OnCandle section you will find the Open and Close prices but there is a major technical detail here: A given close price is only known by the system when the first tick of the next candle which forms the open price is made, which means when the candle is already closed and the next candle started. This basically means that your position will be closed at the level of the next candle BUT with the previous candle close price. In other words, working with the current candle (under construction) is not possible as the close price is not yet known by the system as the prices forming this candle are moving. This is also valid for the High and Low prices and only the open price is defined when a candle is under construction. Therefore, you need to use historical candles with their defined data to implement your idea. (please check the attached strategy that you can import by clicking on: File > import) VJF says "29.10.2014 15:47:40 Cannot close order in CREATED, CLOSED or CANCELED state, current state - [CLOSED]"
This basically means that your strategy is trying to close a position which is already in closed status. therefore an error is generated.
3. Last question is about calculation. Lets say I want to open a buy position whenever the difference between the upper and lower bollinger bands reaches a minimum over x periods. Does anybody know how to do that?
Attached an example of what you described with some notes/
Hope this helps !
Attachments: |
BBands_Sample.vfs [31 KiB]
Downloaded 149 times
|
Open_Close.vfs [27.74 KiB]
Downloaded 119 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
tbm
|
Post subject: Re: Newbie needs help |
Post rating: 0
|
Posted: Mon 03 Nov, 2014, 19:19
|
|
User rating: 0
Joined: Tue 28 Oct, 2014, 21:49 Posts: 4 Location: GermanyGermany
|
Hello Amine, thanks for this great support. You guys are awsome! I think I got a few points, but perhaps you understood me wrong at some issue... might be my fold aswell .. so once again step by step: 1. Got it! But after removing the SL/ TP variables there will be still left the integer parameters, which can not be removed, right? 2. First of all thanks for your template  I think I understood the "candle.close" argument as SL in line with pending orders but it's not exactly what I wanted. What if I don't want to use Pending Orders? The attached Algorithm "MRStretegy" uses pretty simple Entry signals as I tried to describe before. After a Long Candle it opens a Short Position at next Candle Open Price and after a Short Candle it opens a Long Position at next Candly open Price. Now, what if I want to Close each opened Position at the same Candle close Price??? Can't be so difficult but unfortunately I still don't get it... you can use my template to show me the right way if you don't mind. 3. Thanks a lot for the BBands_Sample. To work with the indicators shift parameter I think is the right approach if we wanted to check if current BB_Diff is less then x periods (use shift) ago. But what if I want to find out if it's the local minumum over the last x periods? I do not want to use static values, which means in your sample we need to check weather the current BB Difference is less then the previous 20 in case of X=20 (Min over x periods). Therefore I think we have to work with arrays ...??? Thanks again for your assistance and patience... Yours, tbm
Attachments: |
File comment: This refers to 2. Question. Please use for help me out...
MRStrategy.vfs [25.74 KiB]
Downloaded 139 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Newbie needs help |
Post rating: 2
|
Posted: Tue 04 Nov, 2014, 14:15
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi there, Please find my answers below: 1. Got it! But after removing the SL/ TP variables there will be still left the integer parameters, which can not be removed, right? Well if you need to remove definitely the SL and TP variables, you have also to remove them from the global variables as shown in this topic: viewtopic.php?f=146&t=51825 2. What if I don't want to use Pending Orders? The only way to open a trade using conditions such as candle open price is to work with pending open command because if we consider here an open at market command the order will be triggered straight and executed so you're not 100% sure that the execution price will be candle open price unless you input a set of conditions before and wait till the previous candle is closed and then push your market order on the very first tick of the next candle which is the next candle open price but again a SL order equal to the close price of the current candle (under construction ) is simply not possible as the close price is not yet known. There might be a workaround here depends on your conditions. Attached a second version of the strategy. 3. Unfortunately when it comes to indicators, the shift value is the only choice to grab historical values. This means that if your X periods is 20 then you have to implement 20 BBands with each different shift value and calculate the deltas and retrieve the min value out of this array. That's basically what is implemented in the second attached strategy. Working with arrays is indeed possible but only limited to candles data, for this we use "Get historical Candles" block which imbed a set of candles data (OHLC, Volume, etc..) in an array variable. Hope this helps.
Attachments: |
BBands_Sample_V2.vfs [33.36 KiB]
Downloaded 104 times
|
Open_Close_V2.vfs [33 KiB]
Downloaded 121 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
tbm
|
Post subject: Re: Newbie needs help |
Post rating: 0
|
Posted: Thu 06 Nov, 2014, 15:10
|
|
User rating: 0
Joined: Tue 28 Oct, 2014, 21:49 Posts: 4 Location: GermanyGermany
|
Hello again, and thanks a lot for your kind help. I think I once again learned some new basics on how to code strategies with VisualJforex. Unfortunetly I am a little disappointed because to code simple things with VJF seems to be not as easy as initially expaced and thats why I not yet closed the topic and wand to give it one last try ... The "Open_Close_V2" you posted is pretty close to what I wanted but still distinguishes in a few points. For example it does not trade every candle, right ? So here once again -> as simple as this: - Buy after a short candle (at next candle open price and close at close price) - Sell after a long candle (at next candle open price and close at close price) I know about the difficulties you told me several times, so that the actual candle close price is first known at next candle open so we might have a problem when we want to close at current close price. But ... 1. The strategy does not mind having the exact price. So for differences between actual close and next candle open price working with the slippage parameter I think will be ok 2. Hard to imagine there is no work arround so that the actual close price is known at same candle. This is because time itself, so working with 1 minute bars current tick price at 60th sec. equals probably the close price! So my question: Is it possible to track order open time??? If yes we could code sth. like this: IF period = 60 min, open oder at first sec. of new bar and close after 3600 sec. Concering BBands I sadly know what you mean even though its quite far away from coding dynamic strategies and becomes heavily hard to handle if you want to be the number of periods an global variable that can be changed in the settings... so we have all these indicators which is fine but we can not easily use their historical data and so we have to give an effort and insert dozends of them differing the shift values to work out  Kind regards, tbm PS 1: For those who are wondering about the stupid little strategy I want to say that you are right because it doesn't work any more but it worked out over more then 1 decade (on daily basis) in the US Markets pretty well. You can try it out on the SuP oder DOW if you like and see what wwould have happend to your account. Simple algorithms are mostly the best but after uncertain time they stop working and so did this one after the financial crises PS 2: Ducascopy provides a lot of indicators but a actually miss a quite famous one often called "market profile". It goes back to Peter Steidlmayer. Will Dukascopy provide such indicators in the near future?? 
Attachments: |
BUY_SELL.jpg [29.61 KiB]
Downloaded 370 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Newbie needs help |
Post rating: 2
|
Posted: Thu 06 Nov, 2014, 17:50
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi,
Thanks for the feedback.
I've attached a quick example based on your 'expiry candle time' method to show you the logic and I only implemented the Long flow so you can add the short flow accordingly. In some cases the trade is not closed at the level of the same candle which can be due to the availability of the tick price @ the expiry time (which , by the way, can happen in a LIVE trading conditions compared to Demo/historical tester environment) or even the time calculation method. In any case, even if the trade is closed few milliseconds later it will be based on the next price open which is almost equal to the previous candle close. On a tick chart it is a matter of less than few ticks which is not a big deal in my opinion. Please review this example and feel free to experiment your ideas and test them. We'll be happy to help you as much as we can.
For the BBands issue, this is definitely something that we can improve in the future but currently it is possible to work with dynamic shift values which increases using a counter for instance and afterwords the output of the indicator can be saved and used.
Thanks
Attachments: |
Workaround_1.vfs [32 KiB]
Downloaded 105 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
tbm
|
Post subject: Re: Newbie needs help |
Post rating: 0
|
Posted: Wed 12 Nov, 2014, 18:02
|
|
User rating: 0
Joined: Tue 28 Oct, 2014, 21:49 Posts: 4 Location: GermanyGermany
|
Hello, thanks again for great support. I think I will "muddle" myself though alone now for a while and close this thead  best regards, tbm
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Newbie needs help |
Post rating: 1
|
Posted: Thu 13 Nov, 2014, 12:10
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi,
Fair enough, I just added an example of BBands using a dynmic shift counter for your consideration; The shift value (that is set as a global variable) determines the number of candles to be checked and therefore their lower BBand value. Once the countdown is made, the minimum variable will display the lowest BBand low value.
Attachments: |
BBandsWorkaround_2.vfs [30.41 KiB]
Downloaded 121 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|