Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
608 views
in Technique[技术] by (71.8m points)

pine script - Can't understand strategy exit and Pyramiding

Following is my code

strategy("50 pips a day", shorttitle = '50 pips' , overlay = true , pyramiding = 1)

tradestart = time == timestamp("GMT+0" , year , month , dayofmonth , 7 , 0 , 0)

bgcolor( tradestart ? color.silver : na, transp = 0)

if tradestart
    strategy.entry('Buy' , long = true , stop = high , oca_name = 'Breakout' , oca_type = strategy.oca.cancel )
    strategy.entry('Sell' , long = false  , stop = low , oca_name = 'Breakout' , oca_type = strategy.oca.cancel)
    strategy.exit('Buy Exit' , from_entry = 'Buy' , profit = 50 * 10)

Strategy Exit My condition states that after 15:00 (which has the transparent background color) , there should be a Buy Order

a. Why is there a Buy Exit at 15:00[I am in GMT +8 ZONE] when my condition clearly states to go Long after 15:00?

b. What does Pyramiding exactly mean ? Does it mean if I set pyramiding to 1 , then I can place only one Buy Order until I exit it ? And if I set pyramiding to 2 , then I can only place 2 Buy Orders Until I exit both of it ? I genuinely can't understand this concept.

c. strategy.exit('Buy Exit' , from_entry = 'Buy' , profit = 50 * 10),means we take profit from 50 pips right? Is this 50 pips from the close price of the candle?

d. How do I see the profit price as highlighted in purple color in my image? Is there a way to see it on the data window?

Thank you to anyone who can answer my questions


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

a. Why is there a Buy Exit at 15:00[I am in GMT +8 ZONE] when my condition clearly states to go Long after 15:00?

I suppose this exit was from previous entry.

b. What does Pyramiding exactly mean ? Does it mean if I set pyramiding to 1 , then I can place only one Buy Order until I exit it ? And if I set pyramiding to 2 , then I can only place 2 Buy Orders Until I exit both of it ? I genuinely can't understand this concept.

Yes. If the pyramiding == 1 then you can open only one entry in same direction (long or short). If the pyramiding == 2 then you can open only one or two entry in same direction. Etc.

c. strategy.exit('Buy Exit' , from_entry = 'Buy' , profit = 50 * 10),means we take profit from 50 pips right? Is this 50 pips from the close price of the candle?

profit = 50 * 10 means that you set up 500 points profit offset from position entry price.

d. How do I see the profit price as highlighted in purple color in my image? Is there a way to see it on the data window?

No, there are no any order information in the Data Window. You can see execution price of orders in the Trade List in the bottom panel under the chart.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...