EURUSD Mini / Maximum Shares

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #211860 quote
    ZeroCafeine
    Participant
    Senior

    Hi,

    I have a question about the initial capital and maximum share we can buy, let me explain first :

    I want to buy EUR/USD Mini so the size of one contrat (0,1 Lot) is 10 000 USD and with IG and EMSA low I need only 333 USD (10 000 / 30 = 333 that is the margin I need to open one a position of 0,1 Lot), and my initial capital is 1000$ as you can see on the picture below, so noamaly I can open maximum a position with 0,3 (1000$ / 333$ = 3)

    the question is : Why if I put in the code BUY 5 contract it’s steel working ? so the PRT software don’t care about margin and I have to calculate if by myself ? or they have other think I don’t understand ?

    that is the code :

    DEFPARAM CumulateOrders = false
    defparam preloadbars = 2000
    
    EMA20 = ExponentialAverage[20](Close)
    EMA50 = ExponentialAverage[50](Close)
    
    IF EMA20 Crosses Over EMA50 Then
    BullON = 1
    ELSE
    BullON = 0
    ENDIF
    
    IF NOT LongOnMarket AND BullON THEN
    BUY 5 CONTRACTS AT MARKET
    SET STOP LOSS 20 * pipsize
    SET STOP TRAILING 60
    ENDIF

    Best Reguards,
    ZeroCafeine

    Capture-decran-2023-03-21-a-09.30.46.png Capture-decran-2023-03-21-a-09.30.46.png
    #211863 quote
    GraHal
    Participant
    Master

    Why if I put in the code BUY 5 contract it’s steel working

    Above on Demo Account right?

    If you do above on Live Account with only 1000 in Account then you will get Rejected due to “insufficient Funds”

    ZeroCafeine thanked this post
    #211869 quote
    ZeroCafeine
    Participant
    Senior

    ok ok, tks you @GraHal,

    I’m on the real account but disconnected and doing backtesting, So when I will do it for real it’s will be rejected right ?, maybe it’s better to calculate de equity in my algorithme,

    someone can tell me pls why my Stop Loss and my Traling stop is not working ?

    SET STOP LOSS 20 * pipsize
    SET STOP TRAILING 60
    #211870 quote
    GraHal
    Participant
    Master

     

    SET STOP pLOSS 20 * pipsize //add p
    SET STOP pTRAILING 60 //p for points

    it’s will be rejected right

    Rejection will occur when conditions are true and a trade tries to execute.
    
    
    #211888 quote
    robertogozzi
    Moderator
    Master

    in case of two different STOP orders, the last one, sequentially, will always override the previous one. In your case only SET STOP pTRAILING 60 will be executed, but… as it’s incorrectly written, you won’t have any kind of STOP LOSS. It’s quite unlikely that EURUSD may reach +-60.xxxx, because you didn’t use the PIPSIZE conversion.

    Use

    SET STOP pTRAILING 60 * PipSize
    GraHal and ZeroCafeine thanked this post
    #211916 quote
    ZeroCafeine
    Participant
    Senior

    tks you @robertogozzi,

    Thank you very much, you have answered two of my questions at the same time,

    So if I understand correctly I have to place a stop loss first, then I have to create a condition that creates a trading stop once the price has exceeded 60 pips

    IF C1 Then
    SET STOP pLOSS 20 * pipsize
    SLONOFF = 1
    ELSE
    SLONOFF = 0
    ENDIF
    
    IF SLONOFF AND C2 Then
    SET STOP pTRAILING 60 * pipsize
    ENDIF

    also I have a small question in Forex, for exemple at 1,07015 if I add “60 * pipsize” :
    1,07015 + (60 * pipsize) = 1,07615 and not 1,07075 ? because 60 * pipsize = 0,00600 and Not 0,00060 ?

    how about for exmple price in € for a share like 35,013, the pipsize is 0,001€ or 0,01€ ?

    and tks again for all your light

    #211938 quote
    ZeroCafeine
    Participant
    Senior

    when I use your code :

     

    	
    SET STOP pTRAILING 60 * PipSize

    the stop loss at 60 pips not working but when I use like this is working for exit at 60pips :

    	
    SET STOP pTRAILING 60

    tks again, I will try myself with some share and forex and other and come back to this thread

    #211939 quote
    robertogozzi
    Moderator
    Master

    I don’t know what C1 and C2 retain, but it seems correct if the profit is > 60 pips, that’s where the trailing stop starts from, otherwise your stop loss will be disabled and  in case of a sudden reversion, your trade will  heve NO stop loss.

    If you write SET STOP pTRAILING 60 * pipsize after only 30 pips gained, your SL will be disabled, but your trailing stop will only start after another 30 pips are gained. In the meantime you’ll have NO stop loss.

    I suggest that you keep your SL and use a code snippet, among the many on the forum, to add a custom trailing stop to your code.

    As to the last question, your are right; adding 60 to 1,07015 will make it 61,07015, while adding 60*PipSize to 1,07015, will make it 1,07615 as PIPSIZE will convert 60 into 0.0060. But PIPSIZE is not ALWAYS 1/10000th of the price, it’s 1 with indices, 1/1000th with other fax pirs, etc…

    It’s a convenient way to deal with conversions without having to care about what divisor or multiplier has to be used, thus making your code portable to other instruments and assets.

    ZeroCafeine thanked this post
    #211940 quote
    robertogozzi
    Moderator
    Master

    You are right, my fault, the leading “p” in pTRAILING assumes you are using pips without having to convert that number.

    ZeroCafeine thanked this post
    #211994 quote
    ZeroCafeine
    Participant
    Senior

    tks you @robertogozzi

    now I understand for Forex for 60 Pips I have to use p or pipsize then :

    both of this 2 line of code is 60 pips
    SET STOP pLOSS 60
    SET STOP LOSS 60 * pipsize
    

    also when I use Stop Traling with out Stop Loss it’s working like I have a Stop loss, So the Stop Loss get me out at exactely 60 pips but the Stop Traling get me out at an other value, maybe the Stop traling wait for the candle close for execute my order after this candle, that is why I haven’t exactly 60pips (I tryed the chart or 1min and tick by tick but I don’t understand when PRT software execute my order)

    that is the code :

    IF NOT LongOnMarket AND BullON THEN
    BUY 1 CONTRACTS AT MARKET
    SET STOP pLOSS 60
    ENDIF
    
    // it's same of :
    IF NOT LongOnMarket AND BullON THEN
    BUY 1 CONTRACTS AT MARKET
    SET STOP pTRAILING 60 // even we don'"t have a Stop pLoss, this Stop Traling do the same jobs
    ENDIF
    #212014 quote
    robertogozzi
    Moderator
    Master

    I tested it to know exactly the behaviour of SET STOP pTRAILING 60, (I never used it actually).

    It sets a starting Stop Loss at -60 pips, then it raises that stop as the profits grow (the high and low are used, not close, as far as I could understand).

    If the price never exceeds TRADEPRICE (the entry price), then the 60-pip SL will be hit; if the price rises above the entry price, instead, it raises the SL pip by pip (probably the count is done when the candle closes, but considering the high and low prices), until the SL is hit (be it in profit or loss).

    ZeroCafeine and GraHal thanked this post
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

EURUSD Mini / Maximum Shares


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by robertogozzi
2 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/21/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...