2

I have a strong background in VBA, Excel is my second nature. Now I've been trying to get the simplest strategy working on TView for days already but I just cant grab the logic yet.

I created my own indicator and want to use it in a strategy. The simplest way would seem to "read its values out" and go long if it is 1. Seems like a simple if statement to me but I keep on failing all over.

if MyIndicator is 1 go long, sl @ 1 %, trailing stop after 2% in profit with a tolerance of 0,2%

I realized you might have to completely calculate MyIndictator again for the strategy to know what the source is? And cant refer to its Chart? And even then "if MyIndicator=1" is not something Pine seems to understand.

The snippets I found on the net make me think that there are several ways to tell Pine for entering and exiting trades. However, its a real ass to go backwards into. If this would be VBA it would be a 4 line code. Does anybody have a structure for me where I can fit MyIndicator and the percentage variables in?

Maybe this would break the barrier for me. Thanks alot.

Prateek Gupta
  • 2,422
  • 2
  • 16
  • 30

0 Answers0