strategy stops due to rejection

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #149954 quote
    MishapMishap
    Participant
    Junior

    Hi Guys,

    This may be in the wrong spot but im hoping someone can help with an issue i keep getting on my demo account. I have made a rudimentary code that is not finished by any stretch but i wanted to try it out anyway & see how often it triggers live as the testing was throwing odd errors.

    The issue is that it always stops the system with a rejection saying that the account needs more cash. I get that its a funding issue but i don’t see why it is buying such a large number of contracts to create rejection when it is set to buy only 1 & have tight stop/profit.

    I also noticed that it trying to buy well above “atmarket” price.

    Admin, please remove/move if not in correct location.

    thanks in advance.

    //-0-------------0-------------0-------------0-------------0-------------0------------
    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    
    //Trigger to enter position (all other criteria must be met)
    
    //current time frame
    //base moving average indicator percentages 3 candle look back
    Ind1 = Average[15] (close[3])
    Ind2 = Average[20] (close[3])
    
    //moving average current candle 
    Ind5 = Average[15] (close)
    Ind6 = Average[20] (close)
    
    //get distance from averages in percentage relative to one above or below
    DistPer1 = abs(Ind1-Ind2)*100/Ind1
    DistPer2 = abs(Ind5-Ind6)*100/Ind5
    
    c1 = (DistPer2-DistPer1)
    
    // Conditions to enter long positions
    IF c1 >= .02 THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    
    
    // Stops and targets : Enter your protection stops and profit targets here
    
    
    SET TARGET PROFIT 25
    SET STOP LOSS 10
    
    orders-1.png orders-1.png
    #149957 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It’s definitely NOT a tight stop!

    10 is NOT 10 pips, but a price difference, which means that a trade entere at 0.7777 will have a SL set at -19.xxx (so it will be disabled).

    But don’t worry, it’s just a mettere of a couple of p‘s, replace lines 31 and 32 with:

    SET TARGET pPROFIT 25
    SET STOP   pLOSS   10

    the leading “p” means pips, if it’s missing then a price difference is assumed, so 10 would be considerend a price difference of 10.0000 (100K pips).

    Mishap thanked this post
    #149958 quote
    MishapMishap
    Participant
    Junior

    Thanks Roberto, im still learning the ins & outs of pro real code. Such subtle differences 😉

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

strategy stops due to rejection


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mishap @mishap Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by MishapMishap
5 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/10/2020
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...