Buy position When price rised

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #184127 quote
    Link
    Participant
    Senior

    I need code.

     

    I want to buy a long position when the conditions are met and the price rises 0.5%.

    I understand that “at limit” is used, but I can’t.

    #184130 quote
    robertogozzi
    Moderator
    Master

    You need to either wait:

    • for the price to reach +0.5%, then check conditions and, if they are met, enter at market
    • for the conditions to be met and, if they are, check that the price has reached +0.5% and, if it has, enter at market
    #184138 quote
    Link
    Participant
    Senior

    Ok, The second option.

    #184177 quote
    robertogozzi
    Moderator
    Master

    There you go:

    IF close <= lowest[100](low[1]) THEN
       EntryPrice = close * 1.005      //enter next time after a +0.5% is reached
       Flag       = 0
    ENDIF
    IF OnMarket THEN
       Flag = 1
    ENDIF
    MyLongConditions = Not OnMarket AND close CROSSES OVER average[200,0](close)
    IF MyLongConditions AND close >= EntryPrice AND Flag = 0 THEN
       BUY 1 CONTRACT AT MARKET
       Flag = 1
       SET STOP   pLOSS   500
       SET TARGET pPROFIT 1000
    ENDIF
    graphonprice EntryPrice
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Buy position When price rised


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Link @tony-manero Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/29/2021
Status: Active
Attachments: No files
Logo Logo
Loading...