Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hello,
I need solution to two problems: First, sell 9 hold_sell hold_sell hold_sell hold_sell sell 8 hold_sell hold_sell hold_sell take_profit 7 to calculate 9-7=2, and to ignore the second sell signal(fake signal, there can be many of them in between). Second, Depending on the generated BUY signal for example, to generate STOP_LOSS or TAKE_PROFIT signal in a given condition. For example to generate BUY signal at price 10 pips above the Upper Bollinger Band and depending on the generated buy signal to generate, let's say, STOP_LOSS if the difference between the last value and the BUY is -10 pips, or TAKE_PROFIT if the difference between the last value and the BUY signal is +10 pips. To be more clear to you what I mean, is if the formulated condition generates BUY in B1 from A1, then to look for values A2-A1,A3-A1,A4-A1,A5-A1 etc until it meets the condition -10 or +10 pips(to generate STOP_LOSS or TAKE_PROFIT accordingly) and to ignore the in between BUY(fake) signals I would be very thankful if someone wants to help me out solve this problem. I have tried many combinations without success. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
babapusy wrote:
Hello, I need solution to two problems: First, sell 9 hold_sell hold_sell hold_sell hold_sell sell 8 hold_sell hold_sell hold_sell take_profit 7 to calculate 9-7=2, and to ignore the second sell signal(fake signal, there can be many of them in between). That would scare the crap out of me. Something in the system is generating fake buy/sell signals? What happens if those fake signals get acted upon by someone who doesn't know they're fake? As for the actual problem: Sub buySellMath() Dim buy As Boolean, sell As Boolean c = ActiveCell.Column For r = ActiveCell.Row To ActiveCell.End(xlDown).Row l = Split(Cells(r, c).Value) Select Case l(0) Case "buy" If Not (buy Or sell) Then buy = True initialvalue = l(1) End If Case "sell" If Not (buy Or sell) Then sell = True initialvalue = l(1) End If Case "take_profit" If buy Or sell Then profitValue = initialvalue - l(1) buy = False sell = False End If End Select Next End Sub Second, Depending on the generated BUY signal for example, to generate STOP_LOSS or TAKE_PROFIT signal in a given condition. For example to generate BUY signal at price 10 pips above the Upper Bollinger Band and depending on the generated buy signal to generate, let's say, STOP_LOSS if the difference between the last value and the BUY is -10 pips, or TAKE_PROFIT if the difference between the last value and the BUY signal is +10 pips. To be more clear to you what I mean, is if the formulated condition generates BUY in B1 from A1, then to look for values A2-A1,A3-A1,A4-A1,A5-A1 etc until it meets the condition -10 or +10 pips(to generate STOP_LOSS or TAKE_PROFIT accordingly) and to ignore the in between BUY(fake) signals I would be very thankful if someone wants to help me out solve this problem. I have tried many combinations without success. -- Booze! Not noose. That's a whole different party. |
#3
![]() |
|||
|
|||
![]() Quote:
Thanks for the solution. Is this Addin or what? I am total dumb in programming! :)) Last edited by babapusy : April 16th 12 at 07:54 PM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sell to reinvest | Excel Discussion (Misc queries) | |||
Available to sell | Excel Discussion (Misc queries) | |||
Can i sell my vb program | Excel Programming | |||
Import four analogue signals into computer | Excel Discussion (Misc queries) | |||
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals | Excel Programming |