Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

GRANDEUR

Members
  • Content Count

    33
  • Joined

  • Last visited

Everything posted by GRANDEUR

  1. I am new to making functions and named the function you posted not 'NEWHD'. Although, the code doen't work OK so far (there comes only one trade for many mounths), I hope my tuning will help. Alex, thank you so much!
  2. Alex, thank you for you reply! Your approach appeals to me. I am also using MultiCharts but it fails to compile the function you wrote. The error is 'assignment is allowed only for variables or array elements' and 'NEWHD' is highlighted. Why is that? I've never created any functions, only signals. Maybe there is a mistake there. And as for variables assignment under 'inputs', I know about that. I just wanted to write the code as small as possible not loading people with lots of words.
  3. Tams, you're right as always. I'll try to organize my thoughts once again and maybe I'll come up with an answer. If not, I beg your pardon to resume the thread
  4. Sorry, I got it. I just edited #3 of the list above: 3.If high of a bar > all previous highs of today so far AND IT IS > (TODAY'S OPEN+100) then that high is 'highesthigh' (HH). Here is what I wrote so far: if time=0930 then value1=open; if entriestoday(date)<1 and time>0930 and time<1630 and h>(value1+100) then value2=h; if entriestoday(date)<1 and time>0930 and time<1630 and h>(value1+100) then sell short next bar at (value2-50) stop; if time>1630 then buy to cover next bar at market; When I apply this code, trades are executed not at (HH-50) during the day but at (high [of the bar prior to entry]-50).
  5. 1. 30-min timeframe. 2. A new day begins (today). 3. If high of a bar > all previous highs of today so far then that high is 'highesthigh' (HH). 4. HH is calculated each bar during the day. 5. We place a sell short stop order at (HH - 50 points). 6. That stop must be active till the end of the day. 7. If the order is not executed next bar and a new HH is formed then we cancel the order and place a new sell short order with the parameters as in (5). 8. If the order is not executed till the end of the day then we cancel the order. 9. If the order is executed then we buy to cover at the end of the day. 10. Loop.
  6. Come on guys, there must be someone who knows the answer on my question!
  7. Please, help me to code the following simple algorithm. A new day begins. Then I want that a highest high (HH) of the day to be calculated. If a HH is created then I want to place my sell short stop next bar at X points below HH. The stop must be active till the end of the day until it's executed. An exit is at the end of the day. If the stop is not executed that day then the same condition but with new parameters takes place next day. Here is a picture of what I'm telling about: http://file.qip.ru/file/129903846/98832aca/Picture3.html I was able to write a code that sells short only on the next bar after a HH is formed and the condition is fulfilled, but I want that my stop be active until the end of the day.
  8. Maybe, here it is Semi-Automated Trading Using Trend Lines for Tradestation
  9. 3monkeys, thank you for your post but unfortunately I am not allowed to log in to TradeStation Discussion Forum. Actually, I'm a MultiCharts user not TradeStation though the coding languages are similar. Tams, I believe in my inner abilities but I would be glad if somebody helped me in coding the algorithm
  10. What do you mean by the "ID"?The answer I'm looking for is wether it is possiple in TradeStation not only to visualize trends but also to trade them mechanically? For example, I have two lows: 1) swinglow(2,low,2,15)*; 2) swinglow(2,low,2,15). * - Syntax of 'swinglow' function in EasyLanguage: SwingLow(Instance, Price, Strength, Length) So I want to draw an imaginary trendline connecting these two lows, assuming it is an uptrend line. When the price touches this imaginary line from up to down I want there would be a 'sell short' signal. And vice versa for down trendlines and buy signals.
  11. Here is the picture. It is the same condition but there is 'short' instead of 'buy'. http://file.qip.ru/file/129451786/e11d76de/picture.html
  12. Please, could anyone tell me how to code a simple algorithm: buy next bar at down trendline break. Down trendline is formed by connection of two points: swinghigh and swinghigh[1].
  13. I' m sorry for delays in my replies. I got a newer version of MultiCharts. It's become much easier with that new feature but it's not all obvious though. It doesn't work properly with some of my strategies. Now I'm trying to figure it all out for myself. Tams, thank you very much for your help!
  14. Tams, I am using Multicharts but I don't see the 'Backtesting Precision' tab in my 'Strategy Properties'. Maybe, this tab appeared in a new version? I have 5.0 Beta.
  15. Oh, thank you. I clicked 'Insert Image' and have already got tired of looking for file sharing services. Here it is.
  16. Guys, I'm sorry for my incomprehensible style of writing. I thought I expressed myself clearly but seems it was not. So, here is another attempt of mine.
  17. Tams, thank you for your reply! But it seems to me, there is still some misunderstanding. 'Position limits' is used when you don't want to make buy #1 and afterwards buy #2, for examle. It doesn't solve the problem in my case: buy #1 then comes a stoploss (so there are no positions at the time), then comes another buy #1 and there comes another stoploss and so on ALL INSIDE ONE 60-MIN BAR. I want that there would be no more than one buy/sell trade and one cover-trade inside a 60-min bar.
  18. Thank you for your replies! 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.
  19. Sure) 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?
  20. Recently, I tried to figure out how one can backtest day-strategy on smaller timeframes in order to eveluate an optimal stoploss. I was given a piece of advice to use a function 'entriestoday(date)<1'. It works fine to me. 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!
  21. Thank you, Flyingdutchmen! Now the script works just as I wanted it to work! All its left is creating and tuning robust systems) I wish you good luck!
  22. I am sorry for delays in my posts. I'm not always able to test what you write rightaway. First of all, I'd like to thank you so much for 'Value1 = Average( Range[1] of Data2, 2);'! With loops you mentioned I'm not aquainted yet and once it was easier for me to write '((HighD(1)+HighD(2))/2) - ((LowD(1)+LowD(2))' for 30-time period:) I don't see either. Moreover, I like your script more because it doesn't depend on the timeframe. In my script I have to change the beginning and the end of the session each time I change the timeframe (5-min, 15-min, etc.). That's what I called 'complicated'.However, your script sometimes misses the first bars in the session and doesn't trade on them and mine does. I don't know why. But I faced here another problem. Let the script be the same. Usually it works fine but some trades are weird to me. At first, they were absolutely weird but then became just weird Sometimes buy trades happen not on next day's open+500 but happen on the next day's first bar but at the price of previous day's open+500 (on the previous day there was no trade because the condition was not fulfilled for that day). How can I handle this?
  23. Flyingdutchmen, thank you for your help! Unfortunately, I faced some difficulties implementing your pieces of advice. About the second solution. When I just compile 'Buy at Open Of Next Bar+500 Stop;', an error comes up - 'syntax error, expecting 'stop', 'limit', 'contracts', or 'shares''(after the word 'open' as far as I see). I use MultiCharts. Then I verified the same line in TradeStation - it's the same. That's why I skipped on this solution before. I thought I missed something but you're still writing it. Does my software not understand the function your software does? About an Average range of daily ranges. I tested those two variants but the calculations aren't equal. It seems, that in the second variant an average equals just the previous day's range. I don't know why. The last code you posted (slightly edited) Variables: EP(0); If D <> D[1] Then EP = Open+500; Condition1 = EntriesToday(Date) = 0; If Condition1 and High < EP Then Buy Next Bar EP Stop; SetStopLoss(1000); If Time = 2359 Then Sell next bar at market; works somehow strange. Sometimes it buys on the first bar that satisfy the condition, sometimes not. Here is the image (buy on the 28-th). I found out that the code that works is If time=1030 {first bar of the session} then value1=o; If entriestoday(date)<1 then buy next bar at value1+500 stop; SetStopLoss(1000); If Time = 2359 {the last bar of the session} Then Sell next bar at market; But it's a bit complicated.
  24. An entry on the open of the second bar of the session is not what I'm looking for. I need the open price of the first bar. When I tried to buy on the 'next bar open stop' on the very last bar of the previous session it also wouldn't work as I'd like to. It is traded not every day but every other day. Guys, please, help me to code the following simple condition: the timeframe is less than daily. I want to buy at the open of next session + 500 point. If marketposition>0 then setstoploss(1000). Exit on the open of next day. Every day there should be no more than one entry-trade and one exit-trade on stoploss. The best I wrote myself was: {2349 - the time of last bar of the session} if entriestoday(date)<1 and time=2349 then buy next bar at open+500 stop; setstopposition; setstoploss(1000); if marketposition>0 and time=2349 then sell next bar at market;
  25. When I apply 'buy next bar at open of tomorrow+1 stop;' to daily chart, everything works OK. But when I apply the same line to 5-min chart, the buying happens not at the open+1 of tomorrow but at the open+1 of the second 5-min bar tomorrow. Obviously, 'buy next bar at market' won't work right here.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.