| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Eliminating Repeated Trades Then I tried to implement something similar to an Hour-strategy. I tried to backtest it on 5-min timeframe. But, unfortunately, 'entriestoday(date)<1' doesn't work properly in that case. Taking into account all written above, please help me to recode the following simple strategy so that I can backtest a stoploss amount: inputs: x(100); buy next bar at h stop; setstopposition; setstoploss(x); sell short next bar at l stop; setstopposition; setstoploss(x); Thank you in advance! | ||
| |
|
| | #2 | ||
![]() | Re: Eliminating Repeated Trades Quote:
if you can rewrite the above in the following format, I might be able to give you a hand: 1. write out your thoughts ONE logic PER LINE 2. write out your logic ONE action per LINE 3. write out your action ONE sentence per LINE 4. start a NEW LINE for every sentence
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
![]() | Re: Eliminating Repeated Trades There is a 60-min strategy: Buy at the high of the previous 60-min bar on stop. Sell at the low of the previous 60-min bar on stop. Anytime there is an open position, place a stoploss. That is it. I want to eveluate the best stoploss value. It's impossible to eveluate it on 60-min bars. Various stoploss values must be tested on smaller timeframe bars. What code will let eveluate an optimized stoploss value? | ||
| |
|
| | #4 | ||
![]() | Re: Eliminating Repeated Trades Quote:
h[1] = high of the previous bar EasyLanguage works on bar-by-bar basis; it doesn't matter what is the bar resolution...
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #5 | ||
![]() | Re: Eliminating Repeated Trades Quote:
what do you mean by "impossible" ? your stop loss is too small? it triggers too soon? not triggered at all? etc...
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #6 | ||
![]() | Re: Eliminating Repeated Trades Quote:
I suspect that what you are trying to do is to set the stoploss to be based upon the price movement expected in the time period (data compression) being used e.g. to base it upon the bar range or the ATR. If that is what you are trying to do then it is probably easier (from a visualisation viewpoint) to use SETSTOPSHARE. This sets the amount per share or contract. The important point is that it does not need to be a fixed amount. You can have an input or variable called, say, SL_AMOUNT. Then you have the code SETSTOPSHARE; SETSTOPLOSS(SL_AMOUNT); This will set the stop loss per share/contract to be the amount the input or variable contains. So you could set it to ATR SL_AMOUNT = AvgTrueRange(10); This would set it to the average true range based on 10 bars for the time interval (data compression) chosen in the plot. In other words the ATR and hence the SL_AMOUNT and hence the stop loss would vary according to the data compression. You could also use an IF statement to set it to specific values based on bar type and interval e;g. IF BARTYPE = 1 AND BARINTERVAL = 10 then SL_AMOUNT = 5; This would set the stop loss amount to 5 for a 10 min intraday bar. BARTYPE values are 0 = TickBar 1 = Intraday 2 = Daily 3 = Weekly 4 = Monthly 5 = Point & Figure 6 = (reserved) 7 = (reserved) 8 = Kagi 9 = Kase 10 = Line Break 11 = Momentum 12 = Range 13 = Renko Personally however I would recommend using something like a volatility based stopped such as ATR which would automatically select stoploss levels at a basis appropirate to the time interval being traded. You don't have to think about it then. Finally another possibility of course is to set a stop loss based on 1 time interval but to use it in a stategy based on another interval. For example you could have a strategy entered onto a 1 min chart, which uses an ATR taken from a 10 min chart, but that's a whole new thread on multiple data feeds and potentially GVs, ADEs and so on, which I don't want to go into at present. Charlton | ||
| |
|
| | #7 | ||
![]() | Re: Eliminating Repeated Trades But it seems to me that you haven't understood what I was asking for. Let me express my question by images. ![]() On the first chart there are 60-min bars. And the code for the strategy used is: buy next bar at h stop; setstopposition; setstoploss(500); sell short next bar at l stop; setstopposition; setstoploss(500); On the second chart there are two data feeds: 5-min and 60-min. The code for the strategy is: buy next bar at h of data2 stop; setstopposition; setstoploss(300); sell short next bar at l of data2 stop; setstopposition; setstoploss(300); So I want to trade on 60-min bars but I want also to verify wether my stoplosses are not executed inside 60-min bars. On the third chart is a magnification of chart #2. One can see there that there were several trades inside one 60-min bar that shouldn't take place. | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To Eliminate Repeated Trades (EL) | GRANDEUR | Coding Forum | 1 | 11-02-2009 04:28 AM |
| Stevenvegas Trades | Stevenvegas | Traders Log | 62 | 04-21-2009 08:50 AM |
| B&B Trades | B&Btrades | Beginners Forum | 0 | 03-31-2009 12:43 PM |
| What Do You Do in Between Trades? | Szymon | General Discussion | 21 | 02-24-2009 06:05 AM |
| My trades | Pippy23 | Forex Trading Laboratory | 13 | 04-03-2007 07:10 PM |