Skip to content

How trade conditions work (e.g. Trade_WPR)? #308

Answered by kenorb
soumsena asked this question in Q&A
Discussion options

You must be logged in to vote

Buy

    case ORDER_TYPE_BUY:                              
      result = wpr[period][CURR] > 50 + signal_level; 

Sell

    case ORDER_TYPE_SELL:                                
      result = wpr[period][CURR] < 50 - signal_level;    

You control the signal level with WPR_SignalLevel param, so you don't have to change any code.

So for example, if you've WPR_SignalLevel set to 30, then it is:

  • wpr[period][CURR] > 50 + 30 => -WPR > 80 => WPR > -80 for buy
  • wpr[period][CURR] < 50 - 30 => -WPR < 20 => WPR < -20 for sell

The value is converted from negative to positive at the following line (note the -):

wpr[index][i] = -iWPR(symbol, tf, (int) (WPR_Period * ratio), i + WPR_Shift);

So all yo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kenorb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Question FAQ Frequently Asked Questions
2 participants
Converted from issue

This discussion was converted from issue #116 on September 30, 2021 22:05.