variation price program

Viewing 15 posts - 1 through 15 (of 29 total)
  • Author
    Posts
  • #192210 quote
    Dovakin
    Participant
    New

    Hello I would like to write this code if someone can help me I would be very grateful
    I will buy the asset at the opening of each candle if its price changes by 70%. take profit yes +0.5%. stop-loss -0.5
    I will sell the asset at the opening of each candle if its price changes by 70%. Take profit -0.5%. Stop-loss +0.5%.
    Time unit 15min. Thank you for your understanding.

    #192212 quote
    JS
    Participant
    Senior

    Hi @Dovakin

    Do you mean a price change of 70% in 15 minutes?
    #192246 quote
    Dovakin
    Participant
    New

    no. 10%. sorry.

    #192247 quote
    Dovakin
    Participant
    New
    can you please make me this code for the cac 40. On opening of each candle if the stock takes 1%. Open buy position. Close the position if it takes +1%. Stop loss -0.8% Also on each candle opening if the cac loses 1%. Open sell position. Close position if it loses 1%. Stop-loss +0.8%. time 1h. Thank you for your time.
    #192249 quote
    JS
    Participant
    Senior
    DefParam CumulateOrders = False
    
    If Close / Close[1] > 1.01 then
    Buy 1 contract at market
    ElsIf Close / Close[1] < 0.99 then
    SellShort 1 contract at market
    EndIf
    
    Set Target %Profit 1
    Set Stop %Loss 0.8

    You can adjust everything yourself:

    1. Number of contracts
    2. % stop loss
    3. % take profit
    4. Tijdframe
    5. Index
    #192250 quote
    Dovakin
    Participant
    New
    Thank you very much but I have entered the code but nothing is displayed no matter what period I choose
    #192252 quote
    JS
    Participant
    Senior
    Hi @Dovakin Did you BackTest the code?
    #192253 quote
    Dovakin
    Participant
    New
    I don’t know if I expressed myself badly but this is exactly what I want each candle has an opening i want to take position from that opening. then i want to multiply that opening by 1%. and exit that candle if i am right with a 0.6% gain. if i am wrong i take a 0.3% loss. i am sorry i am a novice.
    #192255 quote
    JS
    Participant
    Senior

    At the opening of a candle what kind of position do you want to take (Long or Short) and under what conditions do you want to go Long or Short?

    I don’t understand what you mean by “multiply the opening by 1%”…

    #192265 quote
    Dovakin
    Participant
    New
    For example this candle of March 16, 22 of the ndx 100 at 20:00 the opening is 13738.2.  In the framework of a long position, if the asset gains 1%, I take 13738.2 and multiply by 1%. That gives me 13875.582. If I reach 13875.582 I take a buy position. If from 13875.582 I gain 0.4% I exit my buy position with a gain. In case I reach 13875.582 and I have a drop of 0.4% I exit my buy position with a loss. And I do this for each candle on a time unit of 1 hour.
    In the case of a short position like this 26th of April at 3pm of the ndx 100. The opening is 13477.7. If the asset loses 1%. I take the opening which is 13477.7 which I multiple by 1%. That makes 13342.99. And then I take a sell position. If from 13342.99 I gain 0.4% I exit my sell position with my gain. If on the contrary the price goes up I exit at 0.4% with a loss. And this for each candle on a time unit of 1 hour
    NDX-MARS-16-2022.jpg NDX-MARS-16-2022.jpg 26-APRIL-2022.jpg 26-APRIL-2022.jpg
    #192271 quote
    JS
    Participant
    Senior
    Hi @Dovakin
    DefParam CumulateOrders = False
    
    If OnMarket[1] and Not OnMarket then
    OpenPrice = Open
    EndIf
     
    If Close > OpenPrice * 1.01 then
    Buy 1 contract at market
    ElsIf Close < OpenPrice * 0.99 then
    SellShort 1 contract at market
    EndIf
     
    Set Target %Profit 0.4
    Set Stop %Loss 0.4
    
    Nicolas, phoentzs and Midlanddave thanked this post
    Schermafbeelding-2022-04-27-om-09.09.11.png Schermafbeelding-2022-04-27-om-09.09.11.png
    #192278 quote
    phoentzs
    Participant
    Master
    What timeframe is that?
    #192281 quote
    Dovakin
    Participant
    New
    thank you Mr JS.
    <span class="Y2IQFc" lang="en">just one thing if we take this trade from April 25 at 4 p.m. it's the same for the others.</span>
    Entry is 13384,015 NOT ONLY 13251,5. BECAUSE I TAKE POSITON WHEN<span class=”Apple-converted-space”>  </span>I HAVE OPEN*1% like here 13251,5*0,01 equal 13251,5+132,52 equal 13384,015.<span class=”Apple-converted-space”>  </span>IF I HAVE 0,4% OF PROFIT I CLOSE MY POSITION LIKE 13384,015*0,4% EQUAL 13384,015+53,55 equal<span class=”Apple-converted-space”>  </span>134737,55 , I close my position with profit. But if I have 13384,015*0,4 equal 13384,015-53,55 equal 13330,47 I close my position with loss.
    trade-25-april-.jpg trade-25-april-.jpg
    #192283 quote
    JS
    Participant
    Senior
    @phoentzs TF = 1 hour
    #192286 quote
    PeterSt
    Participant
    Master
    just one thing if we take this trade from April 25 at 4 p.m. it’s the same for the others. Entry is 13384,015 not only 13251,5. Because I take position when I have open*1% like here 13251,5*0,01 equal 13251,5+132,52 equal 13384,015. If I have 0,4% of profit I close my position like 13384,015*0,4% EQUAL 13384,015+53,55 equal 134737,55 , I close my position with profit. But if I have 13384,015*0,4 equal 13384,015-53,55 equal 13330,47 I close my position with loss.
Viewing 15 posts - 1 through 15 (of 29 total)
  • You must be logged in to reply to this topic.

variation price program


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Dovakin @dovakin Participant
Summary

This topic contains 28 replies,
has 4 voices, and was last updated by Dovakin
3 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/25/2022
Status: Active
Attachments: 8 files
Logo Logo
Loading...