Caculate Pip Size + Close position 10 pip profit or loss

Viewed 26

Never written code, Kind of making a frankenstein im sure at this point. But I would like to have a pip size open and close. It appears to open many profitable ones then close at breakeven.

GetPipSize() =>
    syminfo.mintick * (syminfo.type == 'forex' ? 1000 : 1)


//////////// open position  /////////////////////
//{
longCondition = ta.crossunder(norm_c, f1[1]) and strategy.position_size == 0 and Trend == 1
if longCondition
    strategy.entry('My Long Entry Id', strategy.long)

shortCondition = ta.crossover(norm_c, f1[1]) and strategy.position_size == 0 and Trend == -1
if shortCondition
    strategy.entry('My Short Entry Id', strategy.short)

strategy.exit('x', loss=10, profit=10)
0 Answers
Related