Help coding basic stock trading strategy with today's high

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #83756 quote
    elpaso5
    Participant
    New

    Can someone please help code a basic end of day stock trading strategy? Buy next day if the price reaches => today’s high. I will need to work on an exit strategy.

    This is my code that does work properly :

    If not longonmarket and high >= DHigh(1) then
    buy at market
    ENDIF

    Thanks very much!

    #83760 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums.

    I have moved your post as it was in the wrong forum. You posted in the ProBuilder forum which is for indicator questions/topics. I have moved it to the ProOrder section which is for strategy questions/topics. Please try to post in the correct forum with future topics to maximize your chance of finding a solution and to prevent any confusion..

    Also please use the ‘Insert PRT Code’ button when posting code as it makes it easier for others to read. I have tidied up your post. 🙂

    elpaso5 thanked this post
    #83783 quote
    GraHal
    Participant
    Master

    How about …

    //Your Entry
    If not longonmarket and high >= DHigh(1) then
    buy at market
    ENDIF
    
    //Exit for you to Consider a value for x?
    If Longonmarket and close < Average(x) Then
    Sell at Market
    Endif
    elpaso5 thanked this post
    #83837 quote
    elpaso5
    Participant
    New

    Thanks, GraHal for moving this post. Can you or someone please correct my code? It does not enter and exit based on my strategy. It is an EOD strategy.

    Buy next day if the price reaches => today’s high. Sell (if in the market) if the price drops to previous days low. Thanks very much!

    If not longonmarket and high >= DHigh(1) then
    buy at market
    ENDIF
    If longonmarket and low <= DLow(1) then
    Sell at market
    ENDIF
    #83840 quote
    Vonasi
    Moderator
    Master
    If not longonmarket then
    buy 1 contract at DHigh stop
    SellPrice = DLow
    ENDIF
    
    Sell at SellPrice stop
    

    This places pending orders on the market. Use on daily chart.

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

Help coding basic stock trading strategy with today's high


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
elpaso5 @elpaso5 Participant
Summary

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

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