Buy/sell at certain time/dates

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #82994 quote
    CharlieByrd
    Participant
    Junior

    Hello guys!

    First of all im sorry if there is a thread of this topic. If there is could you please link it? I cant find the search option.

    Now to my question:

    I would love if someone can help me to write a backtest code for example buy gbpjpy 12:00 and close at 15:00

    more specific:

    Monday-friday: buy @ 12:00 – sell position @ 15:00

    I hope you guys could spare a minute or two to help me out.

    Many thanks in advance!

    #83006 quote
    CharlieByrd
    Participant
    Junior

    Sorry forgot to add my “code”, please bare with me im pretty new to this 🙂

    if time = 110000 then
    sell 1 lot at market
    endif
    if time = 14000 EXITSHORT AT MARKET // I get error at this line, anyone got any idea?
    endif
    
    #83009 quote
    MaoRai54
    Participant
    Master

    hi,

    please time the exit time with the right numbers. one zero is missing

    then

    you forgot to type “then” before exishort

    CharlieByrd thanked this post
    #83013 quote
    robertogozzi
    Moderator
    Master

    To buy you have to use BUY, not sell. Exitshort is to exit short trades, to exit Long trades you have to use SELL, instead.

    Correct IF…ENDIF form is:

    if time=140000 THEN
       EXITSHORT AT MARKET  //this line must be separate from the others
    endif
    CharlieByrd thanked this post
    #83033 quote
    Vonasi
    Moderator
    Master

    CharlieByrd – Please use the ‘Insert PRT Code’ button when putting code in your future posts as it makes it far easier for others to read and understand any code posted in the forums.

    I have tidied up your post for you 🙂

    CharlieByrd thanked this post
    #83038 quote
    CharlieByrd
    Participant
    Junior

    Hello guys,

    First of all sorry for not having the post tidied up Vonasi, lesson learned 🙂 Thanks!

    Im at work at the moment but i will try this later and comeback later with the result.

    Also i forgot to mention i want to backtest this in both short and long, but i think i got some clues from you guys!

    Thank you so much for answering me and helping out, im trying my best to learn this.

    /Charlie

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Buy/sell at certain time/dates


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 4 voices, and was last updated by CharlieByrd
7 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/17/2018
Status: Active
Attachments: No files
Logo Logo
Loading...