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'm still working on testing Day-strategies on intraday data and encounted a problem. In order to buy at tomorrow's Open and get out on the following day's Open I wrote the following: if entriestoday(date)<1 then buy next bar at OpenD(0) stop; setstopposition; setstoploss(1700); if marketposition>0 and time=2359 then sell next bar at market; The code looks OK for me but buy-trades are not executed at the open of tomorrow. Why is that?
  2. Maybe not karma but definitely good! I'll be trying to follow your advice.
  3. Thank you Frank and Fflyingdutchmen! I really appreciate it! There is much that has become clearer for me. Now I'm going to ceck it all out for myself. It's great that there are such people as you guys, who disinterestly devote their time to solving problems of others. Good luck in your trading and not only in trading!
  4. That is it! The function 'entriestoday(date)' is what I was not aware of. Now it works fine. Thank you, Frank! Afterwards I tried to apply this function to my other daily strategies to test if I can optimize my stoplosses. I load 5-min chart and work with it as with daily bars using OpenD, CloseD, HighD, LowD. Also I need to calculate average range of daily bars but it seems it doesn't work OK. I calculate average range of two daily bars as follows: average(HighD(1)-LowD(1),2) but the calculated average is incorrect. It equals only to the range of the last bar. Could you recommend me anything, please?
  5. Yes, Frank, you're absolutely right! I want to lock the variable 'length'. (At first, I tested with 'value1' but overlooked and came to the thought it is the same as without it). The code you wrote works fine but how can I avoid repeated trades when I add stoplosses and they are executed?
  6. Frank, thank you for your reply! I've changed the code according to your advice. Here is what happened: vars: startbar(0), endbar(0), length(0); if time=1030 then startbar=currentbar; if time<=1039 then endbar=currentbar; length=endbar-startbar; if time>1039 and time<=1100 then Buy next bar at highest(h,length) stop; if marketposition=1 and time=1200 then sell next bar at market; If I followed your words correctly, it doesn't work as intended. There are trades between 1040 and 1100 but they are executed not at the high of the price range between 1030 and 1039. (I couldn't even figure out how 'get in' price is calculated). Could you, please, check my code again?
  7. And is it possible to get the highest high for a period of time? I mean something like this: if time > 10:00 and time < 15:00 then the highest high for that period is 'HH'.
  8. Hello everyone! Please, help me to find out how to use different DataFeeds properly. I wrote a code which trades on a smaller timeframe with taking into account a bigger timeframe: buy next bar at highest(high,14) of data2 stop; setstopposition; setstoploss(10); sell next bar at lowest(low,14) of data2 stop; setstopposition; setstoploss(10); What should I do so that repeated trades are not taking place after stop-losses executed?
×
×
  • Create New...

Important Information

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